prompty_anthropic/lib.rs
1//! Anthropic provider for Prompty.
2//!
3//! This crate provides the Anthropic executor and processor implementations,
4//! registered under the key `"anthropic"`.
5//!
6//! Anthropic's Messages API differs from OpenAI in several key ways:
7//! - System messages are extracted to a top-level `system` field
8//! - Messages always use content block arrays `[{type: "text", text: "..."}]`
9//! - Tools use `input_schema` instead of `parameters`
10//! - `max_tokens` is required (defaults to 4096)
11//! - Auth uses `x-api-key` header (not `Authorization: Bearer`)
12//! - Tool results are batched into one user message with `tool_result` blocks
13//!
14//! # Usage
15//!
16//! ```rust,no_run
17//! prompty_anthropic::register();
18//! // Now invoke/turn will use Anthropic for agents with provider="anthropic"
19//! ```
20
21pub mod executor;
22pub mod models;
23pub mod processor;
24pub mod wire;
25
26pub use executor::AnthropicExecutor;
27pub use models::{list_models, list_models_async};
28pub use processor::{AnthropicProcessor, process_response};
29
30/// Register the Anthropic executor and processor in the global registry.
31pub fn register() {
32 prompty::register_executor("anthropic", AnthropicExecutor);
33 prompty::register_processor("anthropic", AnthropicProcessor);
34}