Skip to content

Commit

Permalink
Add global utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
milistu committed May 29, 2024
1 parent cd940f7 commit b76596f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import yaml
from pydantic import BaseModel


class RouterConfig(BaseModel):
model: str
temperature: float


class ChatConfig(BaseModel):
model: str
temperature: float
max_conversation: int


class EmbeddingsConfig(BaseModel):
model: str
dimensions: int


class OpenAIConfig(BaseModel):
embeddings: EmbeddingsConfig
chat: ChatConfig
router: RouterConfig


class Config(BaseModel):
openai: OpenAIConfig


def load_config_from_yaml(yaml_file_path: str) -> Config:
with open(yaml_file_path, "r") as file:
yaml_content = yaml.safe_load(file)
return Config(**yaml_content)

0 comments on commit b76596f

Please sign in to comment.