34 lines
843 B
Python
34 lines
843 B
Python
from mimetypes import init
|
|
from typing import TypedDict
|
|
from dotenv import load_dotenv
|
|
import os
|
|
|
|
load_dotenv()
|
|
|
|
class Config(TypedDict):
|
|
version: str
|
|
port: int
|
|
host: str
|
|
llm_api_key: str
|
|
llm_api_host: str
|
|
llm_model: str
|
|
embedding_api_key: str
|
|
embedding_api_host: str
|
|
embedding_model: str
|
|
|
|
|
|
def _read_config() -> Config:
|
|
return {
|
|
"host": os.getenv("HOST"),
|
|
"port": int(os.getenv("PORT")),
|
|
"version": os.getenv("VERSION"),
|
|
"llm_api_host": os.getenv("LLM_API_HOST"),
|
|
"llm_api_key": os.getenv("LLM_API_KEY"),
|
|
"llm_model": os.getenv("LLM_MODEL"),
|
|
"embedding_api_host": os.getenv("EMBEDDING_API_HOST"),
|
|
"embedding_api_key": os.getenv("EMBEDDING_API_KEY"),
|
|
"embedding_model": os.getenv("EMBEDDING_MODEL"),
|
|
}
|
|
|
|
config = _read_config()
|