Skip to main content

call_anthropic

Function call_anthropic 

Source
pub fn call_anthropic(system: &str, user_prompt: &str) -> Result<String, String>
Expand description

Call the Anthropic Messages API with separate system and user prompts.

Reads ANTHROPIC_API_KEY from environment. Model defaults to claude-sonnet-4-5 but can be overridden via FERRO_AI_MODEL.

Uses Anthropic best practices: system prompt with cache_control, assistant prefill, temperature 0.2 for deterministic output, and 60-second HTTP timeout.