anthropic

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIKeyMeta = provider.ProviderMeta{
	Provider:    provider.ProviderAnthropic,
	AuthMethod:  provider.AuthAPIKey,
	EnvVars:     []string{"ANTHROPIC_API_KEY"},
	DisplayName: "Direct API",
}

APIKeyMeta is the metadata for Anthropic via API Key

View Source
var VertexMeta = provider.ProviderMeta{
	Provider:    provider.ProviderAnthropic,
	AuthMethod:  provider.AuthVertex,
	EnvVars:     []string{"CLOUD_ML_REGION", "ANTHROPIC_VERTEX_PROJECT_ID"},
	DisplayName: "Vertex AI",
}

VertexMeta is the metadata for Anthropic via Vertex AI

Functions

func NewAPIKeyClient

func NewAPIKeyClient(ctx context.Context) (provider.LLMProvider, error)

NewAPIKeyClient creates a new Anthropic client using API Key authentication

func NewVertexClient

func NewVertexClient(ctx context.Context) (provider.LLMProvider, error)

NewVertexClient creates a new Anthropic client using Vertex AI authentication

Types

type Client

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

Client implements the LLMProvider interface using the Anthropic SDK

func NewClient

func NewClient(client anthropic.Client, name string) *Client

NewClient creates a new Anthropic client with the given SDK client

func (*Client) ListModels

func (c *Client) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

ListModels returns available models using the Anthropic Models API, falling back to a static list if the API call fails.

func (*Client) Name

func (c *Client) Name() string

Name returns the provider name

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, opts provider.CompletionOptions) <-chan provider.StreamChunk

Stream sends a completion request and returns a channel of streaming chunks

type VertexClient added in v1.3.1

type VertexClient struct {
	*Client
}

VertexClient wraps the standard Client with Vertex-specific behavior

func (*VertexClient) ListModels added in v1.3.1

func (c *VertexClient) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

ListModels tries the Anthropic Models API first, falling back to a static list with a warning error when the API is unavailable (e.g. 404 on Vertex AI).

Jump to

Keyboard shortcuts

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