Documentation
¶
Overview ¶
Package anthropic implements providers.ModelProvider against the Anthropic Messages API (native tool use). It maps RunLore's engine-agnostic exchange (OpenAI-shaped: assistant tool_calls + separate tool messages) onto Anthropic's content-block form (tool_use blocks; tool_result blocks coalesced into one user turn).
Index ¶
Constants ¶
const DefaultBaseURL = "https://api.anthropic.com"
DefaultBaseURL is the public Anthropic API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
clientcore.Base
// contains filtered or unexported fields
}
Client is an Anthropic Messages API model provider.
func New ¶
New builds a client. baseURL may be empty (defaults to DefaultBaseURL). maxTokens caps output tokens per request; <= 0 falls back to clientcore.DefaultMaxTokens. effort opts into deeper reasoning (output_config.effort: low|medium|high|max, validated in config); empty omits the field entirely. thinking opts into adaptive extended thinking ("adaptive", validated in config); empty keeps today's byte-for-byte behaviour.
func (*Client) Complete ¶
func (c *Client) Complete(ctx context.Context, req providers.CompletionRequest) (providers.CompletionResponse, error)
Complete sends a streaming Messages request with tools and accumulates the full SSE response into a single CompletionResponse. Streaming is internal — callers see the same one-shot interface; consuming the stream avoids the flat request deadline truncating a long completion and lets a per-block input_json_delta reassemble tool arguments incrementally.