diff --git a/rig/rig-core/examples/agent_with_default_max_depth.rs b/rig/rig-core/examples/agent_with_default_max_depth.rs index b96d7f5c2..50ccc23a5 100644 --- a/rig/rig-core/examples/agent_with_default_max_depth.rs +++ b/rig/rig-core/examples/agent_with_default_max_depth.rs @@ -19,7 +19,7 @@ async fn main() -> anyhow::Result<()> { // Create RAG agent with a single context prompt and a dynamic tool source let agent = openai_client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an assistant here to help the user select which tool is most appropriate to perform arithmetic operations. Follow these instructions closely. diff --git a/rig/rig-core/examples/agent_with_mira.rs b/rig/rig-core/examples/agent_with_mira.rs index da9c43362..08f2a4df1 100644 --- a/rig/rig-core/examples/agent_with_mira.rs +++ b/rig/rig-core/examples/agent_with_mira.rs @@ -1,5 +1,5 @@ use rig::prelude::*; -use rig::providers::anthropic::completion::CLAUDE_3_5_SONNET; +use rig::providers::anthropic::completion::CLAUDE_SONNET_4_5; use rig::providers::openai::GPT_4O; use rig::{ completion::{Prompt, ToolDefinition}, @@ -54,7 +54,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create a calculator agent with tools let calculator_agent = client - .agent(CLAUDE_3_5_SONNET) + .agent(CLAUDE_SONNET_4_5) .preamble("You are a calculator here to help the user perform arithmetic operations. Use the tools provided to answer the user's question.") .max_tokens(1024) .tool(Adder) diff --git a/rig/rig-core/examples/anthropic_agent.rs b/rig/rig-core/examples/anthropic_agent.rs index a9f6aa47e..186b3afe1 100644 --- a/rig/rig-core/examples/anthropic_agent.rs +++ b/rig/rig-core/examples/anthropic_agent.rs @@ -11,7 +11,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create agent with a single context prompt let agent = client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble("Be precise and concise.") .temperature(0.5) .build(); diff --git a/rig/rig-core/examples/anthropic_streaming.rs b/rig/rig-core/examples/anthropic_streaming.rs index 94cf274ad..b6d0cd06a 100644 --- a/rig/rig-core/examples/anthropic_streaming.rs +++ b/rig/rig-core/examples/anthropic_streaming.rs @@ -8,7 +8,7 @@ use rig::{ async fn main() -> Result<(), anyhow::Error> { // Create streaming agent with a single context prompt let agent = anthropic::Client::from_env() - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble("Be precise and concise.") .temperature(0.5) .build(); diff --git a/rig/rig-core/examples/anthropic_streaming_with_tools.rs b/rig/rig-core/examples/anthropic_streaming_with_tools.rs index 8c3c6de32..771567af4 100644 --- a/rig/rig-core/examples/anthropic_streaming_with_tools.rs +++ b/rig/rig-core/examples/anthropic_streaming_with_tools.rs @@ -89,7 +89,7 @@ async fn main() -> Result<(), anyhow::Error> { tracing_subscriber::fmt().init(); // Create agent with a single context prompt and two tools let calculator_agent = providers::anthropic::Client::from_env() - .agent(providers::anthropic::completion::CLAUDE_3_5_SONNET) + .agent(providers::anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are a calculator here to help the user perform arithmetic operations. Use the tools provided to answer the user's question. diff --git a/rig/rig-core/examples/anthropic_think_tool.rs b/rig/rig-core/examples/anthropic_think_tool.rs index d444c1c7a..8fc39b24c 100644 --- a/rig/rig-core/examples/anthropic_think_tool.rs +++ b/rig/rig-core/examples/anthropic_think_tool.rs @@ -11,7 +11,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create agent with the Think tool let agent = providers::anthropic::Client::from_env() - .agent(providers::anthropic::completion::CLAUDE_3_7_SONNET) + .agent(providers::anthropic::completion::CLAUDE_SONNET_4_5) .name("Anthropic Thinker") .preamble( "You are a helpful assistant that can solve complex problems. diff --git a/rig/rig-core/examples/anthropic_think_tool_with_other_tools.rs b/rig/rig-core/examples/anthropic_think_tool_with_other_tools.rs index 8827dc041..bcded7ac5 100644 --- a/rig/rig-core/examples/anthropic_think_tool_with_other_tools.rs +++ b/rig/rig-core/examples/anthropic_think_tool_with_other_tools.rs @@ -239,7 +239,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create agent with the Think tool and other tools let agent = client - .agent(providers::anthropic::completion::CLAUDE_3_7_SONNET) + .agent(providers::anthropic::completion::CLAUDE_SONNET_4_5) .name("Customer Service Agent") .preamble( "You are a customer service agent for an online store. diff --git a/rig/rig-core/examples/complex_agentic_loop_claude.rs b/rig/rig-core/examples/complex_agentic_loop_claude.rs index 4165628f5..46fd4cecd 100644 --- a/rig/rig-core/examples/complex_agentic_loop_claude.rs +++ b/rig/rig-core/examples/complex_agentic_loop_claude.rs @@ -85,7 +85,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create specialized research agent that will be used as a tool let research_agent = anthropic_client - .agent(anthropic::completion::CLAUDE_3_7_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are a specialized research agent focused on environmental science and sustainability. Your role is to provide detailed, accurate information about climate change, renewable energy, @@ -97,7 +97,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create a data analysis agent that will be used as a tool let analysis_agent = anthropic_client - .agent(anthropic::completion::CLAUDE_3_7_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are a data analysis agent specialized in interpreting environmental and sustainability data. When given data or statistics, you analyze trends, identify patterns, and draw meaningful conclusions. @@ -109,7 +109,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create a recommendation agent that will be used as a tool let recommendation_agent = anthropic_client - .agent(anthropic::completion::CLAUDE_3_7_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are a recommendation agent specialized in suggesting practical sustainability solutions. Based on research findings and analysis, you provide actionable recommendations for individuals, @@ -122,7 +122,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create the main orchestrator agent that will use all the tools let orchestrator_agent = anthropic_client - .agent(anthropic::completion::CLAUDE_3_7_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an environmental sustainability advisor that helps users understand complex environmental issues and find practical solutions. You have access to several specialized tools: diff --git a/rig/rig-core/examples/enum_dispatch.rs b/rig/rig-core/examples/enum_dispatch.rs index d5c38a8e1..15282cdc1 100644 --- a/rig/rig-core/examples/enum_dispatch.rs +++ b/rig/rig-core/examples/enum_dispatch.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use rig::agent::Agent; use rig::client::{CompletionClient, ProviderClient}; use rig::completion::{Prompt, PromptError}; -use rig::providers::anthropic::completion::CLAUDE_3_7_SONNET; +use rig::providers::anthropic::completion::CLAUDE_SONNET_4_5; use rig::providers::openai::GPT_4O; use rig::providers::{anthropic, openai}; @@ -32,7 +32,7 @@ struct ProviderRegistry(HashMap<&'static str, fn(AgentConfig) -> Agents>); fn anthropic_agent(AgentConfig { name, preamble }: AgentConfig) -> Agents { let agent = anthropic::Client::from_env() - .agent(CLAUDE_3_7_SONNET) + .agent(CLAUDE_SONNET_4_5) .name(name) .preamble(preamble) .build(); diff --git a/rig/rig-core/examples/image.rs b/rig/rig-core/examples/image.rs index 50801826c..150dab67b 100644 --- a/rig/rig-core/examples/image.rs +++ b/rig/rig-core/examples/image.rs @@ -25,7 +25,7 @@ async fn main() -> Result<(), anyhow::Error> { // Create agent with a single context prompt let agent = client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble("You are an image describer.") .temperature(0.5) .build(); diff --git a/rig/rig-core/examples/multi_turn_agent.rs b/rig/rig-core/examples/multi_turn_agent.rs index 846e37dd8..be484a2d0 100644 --- a/rig/rig-core/examples/multi_turn_agent.rs +++ b/rig/rig-core/examples/multi_turn_agent.rs @@ -19,7 +19,7 @@ async fn main() -> anyhow::Result<()> { // Create RAG agent with a single context prompt and a dynamic tool source let agent = openai_client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an assistant here to help the user select which tool is most appropriate to perform arithmetic operations. Follow these instructions closely. diff --git a/rig/rig-core/examples/multi_turn_agent_extended.rs b/rig/rig-core/examples/multi_turn_agent_extended.rs index fe211c4d9..aaf295a54 100644 --- a/rig/rig-core/examples/multi_turn_agent_extended.rs +++ b/rig/rig-core/examples/multi_turn_agent_extended.rs @@ -19,7 +19,7 @@ async fn main() -> anyhow::Result<()> { // Create RAG agent with a single context prompt and a dynamic tool source let agent = openai_client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an assistant here to help the user select which tool is most appropriate to perform arithmetic operations. Follow these instructions closely. diff --git a/rig/rig-core/examples/multi_turn_streaming.rs b/rig/rig-core/examples/multi_turn_streaming.rs index a8e9a7fe3..11dd5c064 100644 --- a/rig/rig-core/examples/multi_turn_streaming.rs +++ b/rig/rig-core/examples/multi_turn_streaming.rs @@ -22,7 +22,7 @@ async fn main() -> anyhow::Result<()> { // Create agent with a single context prompt and a calculator tools let calculator_agent = anthropic_client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an assistant here to help the user select which tool is most appropriate to perform arithmetic operations. Follow these instructions closely. diff --git a/rig/rig-core/examples/reasoning_loop.rs b/rig/rig-core/examples/reasoning_loop.rs index 8fbdf0a45..8f628c68e 100644 --- a/rig/rig-core/examples/reasoning_loop.rs +++ b/rig/rig-core/examples/reasoning_loop.rs @@ -71,12 +71,12 @@ async fn main() -> anyhow::Result<()> { let anthropic_client = anthropic::Client::from_env(); let agent = ReasoningAgent { chain_of_thought_extractor: anthropic_client - .extractor(anthropic::completion::CLAUDE_3_5_SONNET) + .extractor(anthropic::completion::CLAUDE_SONNET_4_5) .preamble(CHAIN_OF_THOUGHT_PROMPT) .build(), executor: anthropic_client - .agent(anthropic::completion::CLAUDE_3_5_SONNET) + .agent(anthropic::completion::CLAUDE_SONNET_4_5) .preamble( "You are an assistant here to help the user select which tool is most appropriate to perform arithmetic operations. Follow these instructions closely. diff --git a/rig/rig-core/src/agent/prompt_request/streaming.rs b/rig/rig-core/src/agent/prompt_request/streaming.rs index 35a1df8c5..eac532f96 100644 --- a/rig/rig-core/src/agent/prompt_request/streaming.rs +++ b/rig/rig-core/src/agent/prompt_request/streaming.rs @@ -680,7 +680,7 @@ mod tests { // (rig reuses current span if one exists, so we need to ensure there's no current span) let client = anthropic::Client::from_env(); let agent = client - .agent(anthropic::completion::CLAUDE_3_5_HAIKU) + .agent(anthropic::completion::CLAUDE_HAIKU_4_5) .preamble("You are a helpful assistant.") .temperature(0.1) .max_tokens(100) diff --git a/rig/rig-core/src/providers/anthropic/completion.rs b/rig/rig-core/src/providers/anthropic/completion.rs index 253277d6b..74456b927 100644 --- a/rig/rig-core/src/providers/anthropic/completion.rs +++ b/rig/rig-core/src/providers/anthropic/completion.rs @@ -22,16 +22,12 @@ use tracing::{Instrument, Level, enabled, info_span}; // Anthropic Completion API // ================================================================ -/// `claude-opus-4-0` completion model -pub const CLAUDE_4_OPUS: &str = "claude-opus-4-0"; -/// `claude-sonnet-4-0` completion model -pub const CLAUDE_4_SONNET: &str = "claude-sonnet-4-0"; -/// `claude-3-7-sonnet-latest` completion model -pub const CLAUDE_3_7_SONNET: &str = "claude-3-7-sonnet-latest"; -/// `claude-3-5-sonnet-latest` completion model -pub const CLAUDE_3_5_SONNET: &str = "claude-3-5-sonnet-latest"; -/// `claude-3-5-haiku-latest` completion model -pub const CLAUDE_3_5_HAIKU: &str = "claude-3-5-haiku-latest"; +/// `claude-opus-4-6` completion model (latest Opus) +pub const CLAUDE_OPUS_4_6: &str = "claude-opus-4-6"; +/// `claude-sonnet-4-5-20250929` completion model (latest Sonnet) +pub const CLAUDE_SONNET_4_5: &str = "claude-sonnet-4-5-20250929"; +/// `claude-haiku-4-5-20251001` completion model (latest Haiku) +pub const CLAUDE_HAIKU_4_5: &str = "claude-haiku-4-5-20251001"; pub const ANTHROPIC_VERSION_2023_01_01: &str = "2023-01-01"; pub const ANTHROPIC_VERSION_2023_06_01: &str = "2023-06-01"; diff --git a/rig/rig-core/src/providers/anthropic/mod.rs b/rig/rig-core/src/providers/anthropic/mod.rs index c13b420b5..41e0ae44d 100644 --- a/rig/rig-core/src/providers/anthropic/mod.rs +++ b/rig/rig-core/src/providers/anthropic/mod.rs @@ -6,7 +6,7 @@ //! //! let client = anthropic::Anthropic::new("YOUR_API_KEY"); //! -//! let sonnet = client.completion_model(anthropic::CLAUDE_3_5_SONNET); +//! let sonnet = client.completion_model(anthropic::CLAUDE_SONNET_4_5); //! ``` pub mod client;