API Reference
DynamicLlmClient
Runtime wrapper that dispatches LlmClient calls to the selected provider implementation.
DynamicLlmClient is the enum Appam constructs from AppConfig before each run. It implements LlmClient by delegating to the inner provider client.
Variants
pub enum DynamicLlmClient {
OpenRouterCompletions(OpenRouterCompletionsClient),
OpenRouterResponses(OpenRouterClient),
Anthropic(AnthropicClient),
OpenAI(OpenAIClient),
OpenAICodex(OpenAICodexClient),
Vertex(VertexClient),
AzureOpenAI { client: OpenAIClient, resource_name: String, api_version: String },
AzureAnthropic { client: AnthropicClient, base_url: String, auth_method: AzureAnthropicAuthMethod },
Bedrock { client: AnthropicClient, region: String, model_id: String, auth_method: BedrockAuthMethod },
}Construction
pub fn from_config(config: &AppConfig) -> Result<Self>Current from_config(...) behavior:
OpenRouterCompletionsusesOpenRouterCompletionsClient::new(config.openrouter.clone(), config.openrouter.reasoning.clone(), config.openrouter.provider_preferences.clone())OpenRouterResponsesusesOpenRouterClient::new(config.openrouter.clone())AnthropicusesAnthropicClient::new(config.anthropic.clone())OpenAIusesOpenAIClient::new(config.openai.clone())OpenAICodexusesOpenAICodexClient::new(config.openai_codex.clone())VertexusesVertexClient::new(config.vertex.clone())AzureOpenAIclonesconfig.openai, injectsazure, then builds anOpenAIClientAzureAnthropicclonesconfig.anthropic, injectsazure, then builds anAnthropicClientBedrockclonesconfig.anthropic, injectsbedrock, and forcesstream = falsefor bearer-token auth
Utility methods
pub fn provider(&self) -> LlmProvider
pub fn provider_name(&self) -> &str
pub fn latest_response_id(&self) -> Option<String>
pub fn set_previous_response_id(&self, response_id: Option<String>)
pub fn take_last_failed_exchange(&self) -> Option<ProviderFailureCapture>Notes:
latest_response_id()currently returns values forOpenAI,OpenAICodex, andAzureOpenAI.set_previous_response_id(...)currently does anything only forOpenAIandAzureOpenAI.take_last_failed_exchange()currently returns provider-native diagnostics forOpenAI,OpenAICodex,AzureOpenAI,Anthropic,AzureAnthropic, andBedrock.