anthropic
ModuleAnthropic.
Contents
Constants
API_VERSIONThe API version requests ask for (`anthropic-version`).ENDPOINTThe Messages API endpoint.MODEL_CLAUDE_3_5_HAIKUClaude 3.5 Haiku.MODEL_CLAUDE_3_5_SONNETClaude 3.5 Sonnet.MODEL_CLAUDE_3_7_SONNETClaude 3.7 Sonnet.MODEL_CLAUDE_3_HAIKUClaude 3 Haiku (the default).MODEL_CLAUDE_3_OPUSClaude 3 Opus.MODEL_CLAUDE_4_OPUSClaude 4 Opus.MODEL_CLAUDE_4_SONNETClaude 4 Sonnet.MODELSUndocumented.use utopia_agents::Anthropic;Rust
pub struct AnthropicAnthropic's Messages API: answers streamed token by token, with token usage (prompt cache writes and reads included) counted from the stream's events; with a schema, a forced tool call whose input is the answer. The description and the first instructions (four blocks in all) are marked for prompt caching. Images attach as base64 sources.
Rust
use utopia_agents::{Adapter, Anthropic, adapters::anthropic};
let adapter = Anthropic::new("test-api-key").with_model(anthropic::MODEL_CLAUDE_4_SONNET);
assert_eq!((adapter.name(), adapter.model()), ("anthropic", "claude-sonnet-4-0"));Rust
pub const API_VERSION: &str = "2023-06-01"The API version requests ask for (anthropic-version).
Rust
pub const ENDPOINT: &str = "https://api.anthropic.com/v1/messages"The Messages API endpoint.
Rust
pub const MODEL_CLAUDE_3_5_HAIKU: &str = "claude-3-5-haiku-latest"Claude 3.5 Haiku.
Rust
pub const MODEL_CLAUDE_3_5_SONNET: &str = "claude-3-5-sonnet-latest"Claude 3.5 Sonnet.
Rust
pub const MODEL_CLAUDE_3_7_SONNET: &str = "claude-3-7-sonnet-latest"Claude 3.7 Sonnet.
Rust
pub const MODEL_CLAUDE_3_HAIKU: &str = "claude-3-haiku-20240307"Claude 3 Haiku (the default).
Rust
pub const MODEL_CLAUDE_3_OPUS: &str = "claude-3-opus-latest"Claude 3 Opus.
Rust
pub const MODEL_CLAUDE_4_OPUS: &str = "claude-opus-4-0"Claude 4 Opus.
Rust
pub const MODEL_CLAUDE_4_SONNET: &str = "claude-sonnet-4-0"Claude 4 Sonnet.
Rust
pub const MODELS: &[&str] = &[ MODEL_CLAUDE_4_OPUS, MODEL_CLAUDE_3_OPUS, MODEL_CLAUDE_4_SONNET, MODEL_CLAUDE_3_7_SONNET, MODEL_CLAUDE_3_5_SONNET, MODEL_CLAUDE_3_5_HAIKU, MODEL_CLAUDE_3_HAIKU, ]Undocumented.