Files
University_Labs_Nego_Agent/server/config/config_models.py
T
민헌andClaude Opus 5.5 13ab9dee84 chore: 2차년도 성능평가 측정 구성 초기 업로드
data(train 520·holdout 120), server(발화 생성 서버), eval(grounding_eval), run_eval.py·run_test.sh.
logs/ 는 실행 때마다 생기는 기록이라 README.md 만 올리고 나머지는 .gitignore 로 뺀다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 14:05:48 +09:00

53 lines
2.7 KiB
Python

"""설정 모델 — config.toml 의 구조를 정의한다."""
from typing import Dict
from pydantic import BaseModel
class ServerConfig(BaseModel):
name: str = "GROUNDING_AGENT"
port: int = 3400
host: str = "0.0.0.0"
class ProfileConfig(BaseModel):
"""요청의 model 값으로 고르는 생성 프로필.
baseline 과 developed 를 같은 서버·같은 입력으로 실행해 그라운딩 효과만 비교한다.
"""
base_url: str = "https://api.openai.com/v1" # OpenAI 호환 서버 (vLLM 등)
model: str = "gpt-4o-2024-08-06" # 실제로 호출할 모델명 (미세조정 모델은 ft:… 이름)
api_key_env: str = "OPENAI_API_KEY" # 비워두면 키 없이 호출 (로컬 vLLM)
grounding: bool = False # True 면 그라운딩 모듈로 프롬프트를 다시 구성한다
price_advice: bool = False # grounding 일 때 이번 턴 제시가를 계산해 알려 준다 (services/grounding/pricing.py)
experience_examples: int = 0 # grounding 일 때 붙일 학습 데이터 경험 예시 수 (0 이면 안 붙임)
strip_knowledge: bool = False # True 면 system 의 공개 정보를 상품·현 단가만 남긴다 (대안 베이스라인)
writing_rules: bool = True # 작성 규칙(resources/prompts/writing_rules.txt)을 붙인다 (두 프로필 동일 — 프롬프트 골격 동일)
postprocess: bool = True # 화자 표시·따옴표 제거 등 형식 정리 (두 프로필 동일 적용 권장)
timeout: float = 120.0
class InstrumentConfig(BaseModel):
"""평가 계측 — 경로를 비우면 해당 계측을 끈다. 상대경로는 서버 루트 기준.
기본 위치는 성능평가 자료 폴더의 logs/server/ (2차년도_성능평가/logs/server) — 측정 증빙을 한곳에 모은다.
"""
log_dir: str = "../logs/server/logs" # 서버 애플리케이션 로그 (server.log, 회전)
generation_log: str = "../logs/server/generation_log.jsonl" # 턴별 그라운딩 근거 로그
response_time_log: str = "../logs/server/response_time.jsonl" # 응답시간
log_prompt: bool = True # LLM 에 보낸 messages 전체를 근거 로그에 남김
def _default_profiles() -> Dict[str, ProfileConfig]:
return {
"baseline": ProfileConfig(grounding=False),
"developed": ProfileConfig(grounding=True, price_advice=True, experience_examples=2),
}
class AppConfig(BaseModel):
server: ServerConfig = ServerConfig()
profiles: Dict[str, ProfileConfig] = _default_profiles()
instrument: InstrumentConfig = InstrumentConfig()