Help us shape the future of Go! Take the 2026 Go Developer Survey

anthropic

package
v0.7.217 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound indicates no Anthropic API key was found in env or config.
	ErrKeyNotFound = errors.New("api key not found")

	// ErrTokenLimit indicates the prompt exceeds the model's context window.
	ErrTokenLimit = errors.New("prompt exceeds context window")
)

Functions

This section is empty.

Types

type Client

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

Client is an Anthropic Messages API client.

func New

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

func (*Client) Ask

func (c *Client) Ask(ctx context.Context, model string, maxTokens int, prompt string, system ...string) (string, error)

Ask sends a single user message and returns the assistant text. An optional system prompt can be passed as the last argument.

type Config added in v0.7.29

type Config struct {
	APIKey  string
	BaseURL string
}

type StatusError added in v0.7.29

type StatusError = hc.StatusError

StatusError is an alias for the shared httpcl.StatusError type.

Jump to

Keyboard shortcuts

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