Skip to main content

anthropic_builder

Function anthropic_builder 

Source
pub fn anthropic_builder(
    model: &str,
    api_key: Option<&str>,
) -> Result<AnthropicBuilder>
Expand description

Create an Anthropic agent builder

§Arguments

  • model - The model name to use
  • api_key - Optional API key from config. Resolution order:
    1. Non-empty api_key parameter (from config)
    2. ANTHROPIC_API_KEY environment variable
    3. Client’s from_env() (requires env var to be set)

§Errors

Returns an error if client creation fails (invalid credentials or missing env var).

§Security

Error messages are sanitized to prevent potential API key exposure.