Skip to main content

Crate prompty_anthropic

Crate prompty_anthropic 

Source
Expand description

Anthropic provider for Prompty.

This crate provides the Anthropic executor and processor implementations, registered under the key "anthropic".

Anthropic’s Messages API differs from OpenAI in several key ways:

  • System messages are extracted to a top-level system field
  • Messages always use content block arrays [{type: "text", text: "..."}]
  • Tools use input_schema instead of parameters
  • max_tokens is required (defaults to 4096)
  • Auth uses x-api-key header (not Authorization: Bearer)
  • Tool results are batched into one user message with tool_result blocks

§Usage

prompty_anthropic::register();
// Now invoke/turn will use Anthropic for agents with provider="anthropic"

Re-exports§

pub use executor::AnthropicExecutor;
pub use models::list_models;
pub use models::list_models_async;
pub use processor::AnthropicProcessor;
pub use processor::process_response;

Modules§

executor
Anthropic executor — sends requests to the Anthropic Messages API.
models
Model discovery for Anthropic — calls GET /v1/models and maps the response to ModelInfo. Anthropic returns context_length and modality information directly, so no enrichment table is needed.
processor
Anthropic processor — extracts results from Anthropic Messages API responses.
wire
Wire format conversion for the Anthropic Messages API.

Functions§

register
Register the Anthropic executor and processor in the global registry.