Expand description
Anthropic (Claude) Provider for AIX
This crate provides an Anthropic provider implementation for the AIX library, supporting both regular and streaming chat completions.
§Example
use aix_anthropic::{AnthropicConfig, AnthropicProvider};
use aix_core::{AiProvider, ChatRequest, ChatMessage};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = AnthropicConfig::new(std::env::var("ANTHROPIC_API_KEY")?);
let provider = AnthropicProvider::new(config)?;
let request = ChatRequest::simple("claude-3-sonnet", "Hello, world!");
let response = provider.chat(request).await?;
println!("Response: {}", response.content);
Ok(())
}Re-exports§
pub use client::AnthropicConfig;pub use client::AnthropicProvider;pub use streaming::AnthropicStreamingResponse;