Первый коммит

This commit is contained in:
2026-02-25 14:47:19 +03:00
commit 43c404f958
171 changed files with 4917 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
from dataclasses import dataclass
import os
@dataclass(frozen=True)
class GigaChatSettings:
auth_url: str
api_url: str
scope: str
credentials: str
ssl_verify: bool
model: str
embedding_model: str
@classmethod
def from_env(cls) -> "GigaChatSettings":
return cls(
auth_url=os.getenv("GIGACHAT_AUTH_URL", "https://ngw.devices.sberbank.ru:9443/api/v2/oauth"),
api_url=os.getenv("GIGACHAT_API_URL", "https://gigachat.devices.sberbank.ru/api/v1"),
scope=os.getenv("GIGACHAT_SCOPE", "GIGACHAT_API_PERS"),
credentials=os.getenv("GIGACHAT_TOKEN", "").strip(),
ssl_verify=os.getenv("GIGACHAT_SSL_VERIFY", "true").lower() in {"1", "true", "yes"},
model=os.getenv("GIGACHAT_MODEL", "GigaChat"),
embedding_model=os.getenv("GIGACHAT_EMBEDDING_MODEL", "Embeddings"),
)