Mentor.LLM.Adapters.Anthropic (mentor v0.2.6)
View SourceAnthropic adapter for Mentor.
This adapter provides integration with Anthropic's Claude models through their Messages API.
Configuration
:api_key
(String.t/0
) - Required. Your Anthropic API key:model
- Required. The Claude model to use:temperature
(float/0
) - Sampling temperature between 0 and 1 The default value is1.0
.:max_tokens
(pos_integer/0
) - Maximum number of tokens to generate The default value is4096
.:url
(String.t/0
) - API endpoint URL The default value is"https://api.anthropic.com/v1/messages"
.:anthropic_version
(String.t/0
) - Anthropic API version The default value is"2023-06-01"
.:http_options
(keyword/0
) - Additional options for the HTTP client The default value is[]
.
Example
Mentor.start_chat_with!(@person_schema)
|> Mentor.configure_adapter({Mentor.LLM.Adapters.Anthropic, api_key: "your-key", model: "claude-3-5-sonnet-20241022"})
|> Mentor.append_message(:user, "Generate a person with the name John")
|> Mentor.complete()
Summary
Functions
Same as complete/1
but raises an exception in case of error