anthropic

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package anthropic implements the text and client-tool subset of the Anthropic streaming Messages API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProtocol    = errors.New("anthropic: invalid protocol message")
	ErrIncomplete  = errors.New("anthropic: incomplete model response")
	ErrRemote      = errors.New("anthropic: provider reported an error")
	ErrLimit       = errors.New("anthropic: protocol size limit exceeded")
	ErrTransport   = errors.New("anthropic: transport failed")
	ErrUnsupported = errors.New("anthropic: unsupported response mode")
)

Functions

This section is empty.

Types

type Client

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

func New

func New(cfg Config) (*Client, error)

New configures a client without performing network I/O. A supplied HTTP client is shallow-copied; its transport remains trusted caller code.

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, req agent.ModelRequest, emit func(string) error) (agent.ModelResponse, error)

Complete performs one streaming model call. Only fully completed responses can yield executable tool calls.

type Config

type Config struct {
	BaseURL    string
	Model      string
	APIKey     string
	MaxTokens  int
	HTTPClient *http.Client
}

Config supplies an explicit API prefix (e.g. https://api.anthropic.com/v1), model, credentials and output budget. Credential discovery is disabled.

type HTTPError

type HTTPError struct{ StatusCode int }

HTTPError reports a status without including the remote response body.

func (*HTTPError) Error

func (e *HTTPError) Error() string

Jump to

Keyboard shortcuts

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