anthropic

package
v0.10.13 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package anthropic implements a agent.Provider for the Anthropic Claude API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	APIKey  string
	Model   string // e.g., "claude-sonnet-4-20250514"
	BaseURL string
	// QuotaSignalObserver, when set, receives a parsed Anthropic rate-limit
	// signal on every HTTP response. The service layer wires this to the
	// provider quota state machine so subscription/daily exhaustion routes
	// dispatch around the provider until its reset window elapses.
	QuotaSignalObserver func(quotaheaders.Signal)
}

Config holds configuration for the Anthropic provider.

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider implements agent.Provider for the Anthropic Messages API.

func New

func New(cfg Config) *Provider

New creates a new Anthropic provider.

func (*Provider) Chat

func (p *Provider) Chat(ctx context.Context, messages []agent.Message, tools []agent.ToolDef, opts agent.Options) (agent.Response, error)

func (*Provider) ChatStartMetadata

func (p *Provider) ChatStartMetadata() (string, string, int)

ChatStartMetadata reports the resolved provider system and upstream server identity known when the provider is constructed.

func (*Provider) ChatStream

func (p *Provider) ChatStream(ctx context.Context, messages []agent.Message, tools []agent.ToolDef, opts agent.Options) (<-chan agent.StreamDelta, error)

ChatStream implements agent.StreamingProvider for token-level streaming.

func (*Provider) SessionStartMetadata

func (p *Provider) SessionStartMetadata() (string, string)

SessionStartMetadata reports the broad provider identity and configured model that should be recorded on session.start events.

Jump to

Keyboard shortcuts

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