Normandy.LLM.ClaudioAdapter (normandy v0.2.0)

View Source

Adapter for integrating Claudio (Anthropic's Claude API client) with Normandy agents.

This adapter implements the Normandy.Agents.Model protocol to enable Normandy agents to use Claude models via the Claudio library.

Features

  • Full Messages API support
  • Tool/function calling integration
  • Streaming responses (via callbacks)
  • Prompt caching support
  • Vision/multimodal inputs
  • Thinking mode configuration

Example

# Initialize Claudio client
client = %Normandy.LLM.ClaudioAdapter{
  api_key: System.get_env("ANTHROPIC_API_KEY"),
  options: [
    timeout: 60_000,
    enable_caching: true
  ]
}

# Use with Normandy agent
agent = Normandy.Agents.BaseAgent.init(%{
  client: client,
  model: "claude-3-5-sonnet-20241022",
  temperature: 0.7
})

{agent, response} = Normandy.Agents.BaseAgent.run(agent, user_input)

Configuration

The adapter supports all Claudio client options:

  • :timeout - Request timeout in milliseconds (default: 30_000)
  • :enable_caching - Enable prompt caching (default: false)
  • :thinking_budget - Token budget for extended thinking mode
  • :base_url - Custom API base URL (for testing)

Summary

Types

t()

@type t() :: %Normandy.LLM.ClaudioAdapter{
  __meta__: term(),
  api_key: String.t(),
  base_url: String.t() | nil,
  options: keyword()
}