Spaces:
Sleeping
Sleeping
File size: 827 Bytes
a9ae09a a6c97c1 a9ae09a cd1dc1d 2cdef68 a9ae09a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import tomllib
from pydantic import Field
from pydantic_settings import BaseSettings
with open("./config/config.toml", "rb") as f:
Config = tomllib.load(f)
class DataStoreSettings(BaseSettings):
index_name: str = Field(min_length=1)
host: str = Field(min_length=1)
embed_model: str = Field(min_length=1)
embed_dim: int = Field(gt=0, le=10_000)
chunk_size: int = Field(gt=0, le=10_000)
chunk_overlap: int = Field(ge=0, le=10_000)
class ModelSettings(BaseSettings):
llm: str = Field(min_length=1)
top_k: int = Field(gt=0, le=15_000)
alpha: float = Field(ge=0.0, le=1.0)
class Settings(BaseSettings):
model: ModelSettings = ModelSettings.model_validate(Config["model"])
datastore: DataStoreSettings = DataStoreSettings.model_validate(Config["datastore"])
cfg = Settings()
|