aeat.adapters.outbound.llm._providers.base module¶
Provider adapter contract for the LLM outbound subpackage.
Defines the normalized request and response shapes that every concrete provider
adapter (Anthropic, OpenAI, Gemini, local, deterministic) consumes and produces,
so the higher-level LLMClient can stay
provider-agnostic. Adapters live in sibling modules under
adapters.outbound.llm._providers.
- class ProviderRequest(**data)[source]¶
Bases:
BaseModelNormalized inbound payload passed to a provider adapter.
- Variables:
request_id – Stable opaque hash identifying the public request, suitable for cross-referencing cache and usage records.
model – Fully resolved provider model identifier.
prompt – Rendered prompt text sent to the provider.
system – Optional system prompt prepended to the conversation.
max_tokens – Maximum number of output tokens to request.
temperature – Sampling temperature in the inclusive range
[0.0, 1.0].timeout_s – Per-request timeout in seconds.
images – Base64-encoded on-host-prepared image inputs for a multimodal read (empty for a text-only request). Transient and in-memory only; a provider adapter forwards them to a local vision model and they are never persisted (sensitive-financial-data-secure-storage-only).
- Parameters:
- request_id: str¶
- model: str¶
- prompt: str¶
- system: str | None¶
- max_tokens: int¶
- temperature: float¶
- timeout_s: int¶
- images: tuple[str, ...]¶
- class ProviderCompletion(**data)[source]¶
Bases:
BaseModelNormalized provider response returned to the public client.
- Variables:
text – Generated text payload.
model – Provider model that actually served the request (may differ from the requested model when a vendor performs upstream routing).
input_tokens – Provider-reported prompt token count.
output_tokens – Provider-reported output token count.
provider_request_id – Provider-native request or message id when available, otherwise
None.
- Parameters:
- text: str¶
- model: str¶
- input_tokens: int¶
- output_tokens: int¶
- provider_request_id: str | None¶
- raise_rate_limit(message, retry_after)[source]¶
Raise a normalized rate-limit error with parsed retry hint.
- Parameters:
- Raises:
LLMRateLimitError – Always raised with the parsed retry hint.
- Return type:
- check_http_error(response, *, provider_name, model, logger)[source]¶
Raise a normalized error for a non-2xx LLM HTTP response.
A 429 raises a rate-limit error carrying the parsed
Retry-Afterhint; any other 5xx or 4xx status raises a provider error. Shared by the OpenAI and Gemini adapters, whose status-dispatch was otherwise identical.- Parameters:
- Raises:
LLMRateLimitError – On HTTP 429.
LLMProviderError – On any other 5xx or 4xx status.
- Return type: