Skip to content

Commit

Permalink
fix pydantic versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
bluecoconut committed Jan 18, 2024
1 parent a2e09f7 commit 3efdca9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lambdaprompt/backends.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import aiohttp
from pydantic import BaseModel, Extra
from pydantic import BaseModel
from typing import Optional, Union, List
import tenacity

Expand Down Expand Up @@ -40,7 +40,7 @@ def get_backend(method):
class Backend:
class Parameters(BaseModel):
class Config:
extra = Extra.forbid
extra = 'forbid'

def __init__(self, **param_override):
self.param_override = self.Parameters(**param_override)
Expand Down Expand Up @@ -92,7 +92,7 @@ class Parameters(RequestBackend.Parameters):
model: str = 'gpt-3.5-turbo-instruct'
presence_penalty: float = 0.2
frequency_penalty: float = 0.2
stop: Optional[Union[str, List[str]]]
stop: Optional[Union[str, List[str]]] = None

def __init__(self, openai_api_key=None, **param_override):
self.openai_api_key = openai_api_key or os.environ.get("OPENAI_API_KEY")
Expand Down
2 changes: 1 addition & 1 deletion lambdaprompt/server/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import aiosqlite
from fastapi import BackgroundTasks, FastAPI, HTTPException
from pydantic import BaseSettings
from pydantic_settings import BaseSettings

import lambdaprompt

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"Programming Language :: Python :: 3",
]
dependencies = [
"requests", "aiohttp", "python-dotenv", "jinja2", "nest_asyncio", "pyyaml", "tenacity", "pydantic"
"requests", "aiohttp", "python-dotenv", "jinja2", "nest_asyncio", "pyyaml", "tenacity", "pydantic", "pydantic-settings"
]
urls = {homepage = "https://github.com/approximatelabs/lambdaprompt"}
dynamic = ["version"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def client(mocker):
from lambdaprompt.server import main

class newSettings(main.Settings):
sqlite_path = ":memory:"
sqlite_path: str = ":memory:"
prompt_library_paths: List[str] = [
str(os.path.join(os.path.split(__file__)[0], "library"))
]
Expand Down

0 comments on commit 3efdca9

Please sign in to comment.