Agent 서버 구축: 멀티테넌트 협상 PoC (UCB Q-Table 학습 + /chat + 14 API + 학습검증 하네스), config 단일화(local.toml) + 빌드 경량화
This commit is contained in:
1 parent
212725e5f9
commit
951d6eab84
140 files changed
+6689
-214
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""LLM 자격증명 — OpenAIConfig(toml)에서 주입.
|
||||
|
||||
프로젝트 컨벤션대로 toml 로 관리한다. P7 에서 TenantConfig.llm 로 테넌트별 오버라이드를 얹을 수 있다.
|
||||
"""
|
||||
|
||||
from dataclasses import dataclass
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
class LlmCredentials:
|
||||
"""LLM 접속 정보. provider 로 openai/azure 분기."""
|
||||
|
||||
provider: str = "openai" # "openai" | "azure"
|
||||
api_key: Optional[str] = None
|
||||
model: Optional[str] = None # openai 모델명 / azure 배포 이름
|
||||
base_url: Optional[str] = None
|
||||
azure_endpoint: Optional[str] = None
|
||||
api_version: Optional[str] = None
|
||||
|
||||
@classmethod
|
||||
def from_config(cls) -> "LlmCredentials":
|
||||
"""server_configs.openai_config 에서 생성 (전역 기본값)."""
|
||||
from config.server_configs import openai_config as c
|
||||
return cls(
|
||||
provider=c.provider, api_key=c.api_key or None, model=c.model or None,
|
||||
base_url=c.base_url or None, azure_endpoint=c.azure_endpoint or None,
|
||||
api_version=c.api_version or None,
|
||||
)
|
||||
|
||||
def is_configured(self) -> bool:
|
||||
if self.provider == "azure":
|
||||
return bool(self.api_key and self.azure_endpoint and self.model)
|
||||
return bool(self.api_key and self.model)
|
||||
Reference in new issue
Block a user