Readd the anthropic provider

This commit is contained in:
Dhanji Prasanna
2025-09-20 18:40:51 +10:00
parent 9b6851c4f5
commit 444245d7dd
6 changed files with 634 additions and 2 deletions

View File

@@ -272,6 +272,17 @@ impl Agent {
providers.register(embedded_provider);
}
// Register Anthropic provider if configured
if let Some(anthropic_config) = &config.providers.anthropic {
let anthropic_provider = g3_providers::AnthropicProvider::new(
anthropic_config.api_key.clone(),
Some(anthropic_config.model.clone()),
anthropic_config.max_tokens,
anthropic_config.temperature,
)?;
providers.register(anthropic_provider);
}
// Set default provider
debug!(
"Setting default provider to: {}",
@@ -317,6 +328,18 @@ impl Agent {
config.agent.max_context_length as u32
}
}
"anthropic" => {
// Claude models have large context windows
if model_name.contains("claude-3-5-sonnet") {
200000 // Claude 3.5 Sonnet supports 200k context
} else if model_name.contains("claude-3-haiku") {
200000 // Claude 3 Haiku supports 200k context
} else if model_name.contains("claude-3-opus") {
200000 // Claude 3 Opus supports 200k context
} else {
200000 // Default for Claude models
}
}
_ => config.agent.max_context_length as u32,
};