Skip to content

Commit

Permalink
feat: add OpenAI configuration options to Settings and update LLM cli…
Browse files Browse the repository at this point in the history
…ent setup (#126)

* chore: Add model and base url customization support for graphiti svc

* fix: formatter
  • Loading branch information
paul-paliychuk committed Sep 19, 2024
1 parent bfd8d3b commit 33908da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/graph_service/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
from typing import Annotated

from fastapi import Depends
from pydantic import Field
from pydantic_settings import BaseSettings, SettingsConfigDict # type: ignore


class Settings(BaseSettings):
openai_api_key: str
openai_base_url: str | None = Field(None)
model_name: str | None = Field(None)
neo4j_uri: str
neo4j_user: str
neo4j_password: str
Expand Down
6 changes: 6 additions & 0 deletions server/graph_service/zep_graphiti.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ async def get_graphiti(settings: ZepEnvDep):
user=settings.neo4j_user,
password=settings.neo4j_password,
)
if settings.openai_base_url is not None:
client.llm_client.config.base_url = settings.openai_base_url
if settings.openai_api_key is not None:
client.llm_client.config.api_key = settings.openai_api_key
if settings.model_name is not None:
client.llm_client.model = settings.model_name
try:
yield client
finally:
Expand Down

0 comments on commit 33908da

Please sign in to comment.