Initial commit

This commit is contained in:
jsahn
2026-08-31 14:33:53 +09:00
commit 8bc43b3ce4
51 changed files with 8902 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Glue between the pipeline and the LLM layer."""
from __future__ import annotations
import logging
from us2kr.config import Settings
from us2kr.llm.base import LLMProvider
from us2kr.llm.minimax import MiniMaxProvider
from us2kr.models import MarketPayload, Report
log = logging.getLogger(__name__)
def build_provider(settings: Settings) -> LLMProvider:
"""Construct the configured LLM provider (MiniMax only for now)."""
return MiniMaxProvider(settings)
def summarize_payload(payload: MarketPayload, provider: LLMProvider) -> tuple[Report, str]:
"""Summarise via the provider and guarantee `report.data_gaps` includes every payload gap."""
report, model_used = provider.summarize(payload)
merged: list[str] = []
for gap in [*payload.data_gaps, *report.data_gaps]:
if gap and gap not in merged:
merged.append(gap)
if merged != list(report.data_gaps):
report = report.model_copy(update={"data_gaps": merged})
log.info("summary produced by %s (%d data gaps)", model_used, len(merged))
return report, model_used