iso8583sim.llm.base
This module defines the abstract base class for LLM providers, allowing
multiple backend implementations (Anthropic, OpenAI, Google, Ollama).
LLMResponse
Response from an LLM provider.
LLMError
Bases: Exception
Base exception for LLM-related errors.
ProviderNotAvailableError
Bases: LLMError
Raised when a provider’s dependencies are not installed.
ProviderConfigError
Bases: LLMError
Raised when provider configuration is invalid.
GenerationError
Bases: LLMError
Raised when message generation fails.
LLMProvider
Bases: ABC
Abstract base class for LLM providers.
All LLM providers must implement this interface to be compatible
with MessageExplainer and MessageGenerator.
Example
complete()
Send a prompt to the LLM and return the response text.
Parameters
Optional system prompt for context
Raises
LLMError: If the API call fails
name
Return the provider name for logging/display.
model
Return the model name being used.
Send a prompt and return response with metadata.
Default implementation wraps complete(). Providers can override
for more detailed metadata.
Parameters
Optional system prompt for context
LLMResponse with content and metadata