2024-09-06 11:07:45 -04:00
|
|
|
from functools import lru_cache
|
|
|
|
from typing import Annotated
|
|
|
|
|
|
|
|
from fastapi import Depends
|
2024-09-19 16:35:36 -04:00
|
|
|
from pydantic import Field
|
2024-09-06 11:07:45 -04:00
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict # type: ignore
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
openai_api_key: str
|
2024-09-19 16:35:36 -04:00
|
|
|
openai_base_url: str | None = Field(None)
|
|
|
|
model_name: str | None = Field(None)
|
2024-09-27 04:31:22 +08:00
|
|
|
embedding_model_name: str | None = Field(None)
|
2024-09-06 11:07:45 -04:00
|
|
|
neo4j_uri: str
|
|
|
|
neo4j_user: str
|
|
|
|
neo4j_password: str
|
|
|
|
|
|
|
|
model_config = SettingsConfigDict(env_file='.env', extra='ignore')
|
|
|
|
|
|
|
|
|
|
|
|
@lru_cache
|
|
|
|
def get_settings():
|
|
|
|
return Settings()
|
|
|
|
|
|
|
|
|
|
|
|
ZepEnvDep = Annotated[Settings, Depends(get_settings)]
|