ant

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel = Claude4Sonnet
	// See https://docs.anthropic.com/en/docs/about-claude/models/all-models for
	// current maximums. There's currently a flag to enable 128k output (output-128k-2025-02-19)
	DefaultMaxTokens = 8192
	APIKeyEnv        = "ANTHROPIC_API_KEY"
	DefaultURL       = "https://api.anthropic.com/v1/messages"
)
View Source
const (
	Claude35Sonnet = "claude-3-5-sonnet-20241022"
	Claude35Haiku  = "claude-3-5-haiku-20241022"
	Claude37Sonnet = "claude-3-7-sonnet-20250219"
	Claude4Sonnet  = "claude-sonnet-4-20250514"
	Claude4Opus    = "claude-opus-4-20250514"
)

Variables

This section is empty.

Functions

func ClaudeModelName added in v0.0.23

func ClaudeModelName(userName string) string

ClaudeModelName returns the Anthropic Claude model name for userName. It returns an empty string if userName is not a recognized Claude model.

func IsClaudeModel added in v0.0.23

func IsClaudeModel(userName string) bool

IsClaudeModel reports whether userName is a user-friendly Claude model. It uses ClaudeModelName under the hood.

Types

type Service

type Service struct {
	HTTPC     *http.Client // defaults to http.DefaultClient if nil
	URL       string       // defaults to DefaultURL if empty
	APIKey    string       // must be non-empty
	Model     string       // defaults to DefaultModel if empty
	MaxTokens int          // defaults to DefaultMaxTokens if zero
	DumpLLM   bool         // whether to dump request/response text to files for debugging; defaults to false
}

Service provides Claude completions. Fields should not be altered concurrently with calling any method on Service.

func (*Service) Do

func (s *Service) Do(ctx context.Context, ir *llm.Request) (*llm.Response, error)

Do sends a request to Anthropic.

func (*Service) TokenContextWindow

func (s *Service) TokenContextWindow() int

TokenContextWindow returns the maximum token context window size for this service

Jump to

Keyboard shortcuts

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