anthropic

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an Anthropic (Claude) LLM client.

It implements the core.Client interface and provides access to Anthropic's Claude models (Claude 3 Opus, Sonnet, Haiku, etc.).

The client handles Anthropic-specific API requirements including the anthropic-version header, x-api-key authentication, and Claude's unique message format with separate system prompts.

func New

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

New creates a new Anthropic client

func (*Client) Chat

func (c *Client) Chat(ctx context.Context, messages []core.Message, opts ...core.Option) (*core.Response, error)

Chat performs a non-streaming chat completion

func (*Client) ChatStream

func (c *Client) ChatStream(ctx context.Context, messages []core.Message, opts ...core.Option) (*core.Stream, error)

ChatStream performs a streaming chat completion

type Config

type Config struct {
	base.Config
}

Config defines configuration for the Anthropic (Claude) client.

Embed base.Config to inherit common settings.

Example:

config := anthropic.Config{
    Config: base.Config{
        APIKey: "sk-ant-...",
        Model:  "claude-3-opus-20240229",
    },
}
client, err := anthropic.New(config)

Jump to

Keyboard shortcuts

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