anthropic

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelClaude3_7SonnetLatest      = "claude-3-7-sonnet-latest"
	ModelClaude3_7Sonnet20250219    = "claude-3-7-sonnet-20250219"
	ModelClaude3_5HaikuLatest       = "claude-3-5-haiku-latest"
	ModelClaude3_5Haiku20241022     = "claude-3-5-haiku-20241022"
	ModelClaudeSonnet4_20250514     = "claude-sonnet-4-20250514"
	ModelClaudeSonnet4_0            = "claude-sonnet-4-0"
	ModelClaude4Sonnet20250514      = "claude-4-sonnet-20250514"
	ModelClaude3_5SonnetLatest      = "claude-3-5-sonnet-latest"
	ModelClaude3_5Sonnet20241022    = "claude-3-5-sonnet-20241022"
	ModelClaude_3_5_Sonnet_20240620 = "claude-3-5-sonnet-20240620"
	ModelClaudeOpus4_0              = "claude-opus-4-0"
	ModelClaudeOpus4_20250514       = "claude-opus-4-20250514"
	ModelClaude4Opus20250514        = "claude-4-opus-20250514"
	ModelClaudeOpus4_1_20250805     = "claude-opus-4-1-20250805"
	// Deprecated: Will reach end-of-life on January 5th, 2026. Please migrate to a
	// newer model. Visit
	// https://docs.anthropic.com/en/docs/resources/model-deprecations for more
	// information.
	ModelClaude3OpusLatest = "claude-3-opus-latest"
	// Deprecated: Will reach end-of-life on January 5th, 2026. Please migrate to a
	// newer model. Visit
	// https://docs.anthropic.com/en/docs/resources/model-deprecations for more
	// information.
	ModelClaude_3_Opus_20240229  = "claude-3-opus-20240229"
	ModelClaude_3_Haiku_20240307 = "claude-3-haiku-20240307"
)

We use the same naming convention as the Anthropic SDK

View Source
const (
	DefaultToolVersion       = codec.DefaultToolVersion
	RecommendedDisplayWidth  = codec.RecommendedDisplayWidth
	RecommendedDisplayHeight = codec.RecommendedDisplayHeight
)

Recommended constants

View Source
const ProviderName = "anthropic"

ProviderName is the name of the Anthropic provider.

Variables

View Source
var (
	// ComputerTool creates a new computer use tool with the specified configuration.
	ComputerTool = codec.ComputerTool

	// BashTool creates a new bash tool with the specified configuration.
	BashTool = codec.BashTool

	// TextEditorTool creates a new text editor tool with the specified configuration.
	TextEditorTool = codec.TextEditorTool
)

Factory functions for creating Anthropic tools

View Source
var (
	// WithComputerVersion sets the computer tool version.
	WithComputerVersion = codec.WithComputerVersion

	// WithDisplayNumber sets the display number for X11 environments.
	WithDisplayNumber = codec.WithDisplayNumber

	// WithBashVersion sets the bash tool version.
	WithBashVersion = codec.WithBashVersion

	// WithTextEditorVersion sets the text editor tool version.
	WithTextEditorVersion = codec.WithTextEditorVersion
)

Option functions for customizing tools

Functions

This section is empty.

Types

type ComputerToolCall

type ComputerToolCall = codec.ComputerToolCall

Tool call types for handling responses

type LanguageModel

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

LanguageModel represents an Anthropic language model.

func NewLanguageModel

func NewLanguageModel(modelID string, opts ...ModelOption) *LanguageModel

NewLanguageModel creates a new Anthropic language model.

func (*LanguageModel) Generate

func (m *LanguageModel) Generate(
	ctx context.Context, prompt []api.Message, opts api.CallOptions,
) (*api.Response, error)

func (*LanguageModel) ModelID

func (m *LanguageModel) ModelID() string

func (*LanguageModel) ProviderName

func (m *LanguageModel) ProviderName() string

func (*LanguageModel) Stream

func (m *LanguageModel) Stream(
	ctx context.Context, prompt []api.Message, opts api.CallOptions,
) (*api.StreamResponse, error)

func (*LanguageModel) SupportedUrls

func (m *LanguageModel) SupportedUrls() []api.SupportedURL

type ModelOption

type ModelOption func(*LanguageModel)

ModelOption is a function type that modifies a LanguageModel.

func WithClient

func WithClient(client anthropic.Client) ModelOption

WithClient returns a ModelOption that sets the client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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