18 lines
536 B
Python
18 lines
536 B
Python
"""LLM provider interface. Implementations must be side-effect free apart from the HTTP call."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
from us2kr.models import MarketPayload, Report
|
|
|
|
|
|
class LLMError(RuntimeError):
|
|
"""Raised when every configured model failed to produce a valid Report."""
|
|
|
|
|
|
class LLMProvider(Protocol):
|
|
def summarize(self, payload: MarketPayload) -> tuple[Report, str]:
|
|
"""Return (validated Report, model id that produced it). Raise LLMError on total failure."""
|
|
...
|