anthropic

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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

View Source
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

func New(baseURL, model, apiKey string, maxTokens int, effort, thinking string) *Client

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL