anthropic

package
v1.115.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertParametersToSchema

func ConvertParametersToSchema(params any) (anthropic.ToolInputSchemaParam, error)

ConvertParametersToSchema converts parameters to Anthropic Schema format

Types

type Client

type Client struct {
	base.Config
	// contains filtered or unexported fields
}

Client represents an Anthropic client wrapper implementing provider.Provider It holds the anthropic client and model config

func NewClient

func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, opts ...options.Opt) (*Client, error)

NewClient creates a new Anthropic client from the provided configuration

func NewClientFromFactory added in v1.115.0

func NewClientFromFactory(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, factory func(context.Context) (anthropic.Client, error), opts ...options.Opt) (*Client, error)

NewClientFromFactory creates a Client backed by the SDK client returned by factory. Config validation runs before factory is invoked, so configuration errors surface without requiring provider credentials. The factory is called once during construction and the returned client is cached for the lifetime of the Client. It is the wiring point for subpackages that target alternative endpoints, such as github.com/docker/docker-agent/pkg/model/provider/anthropic/vertex.

func (*Client) CreateChatCompletionStream

func (c *Client) CreateChatCompletionStream(
	ctx context.Context,
	messages []chat.Message,
	requestTools []tools.Tool,
) (chat.MessageStream, error)

CreateChatCompletionStream creates a streaming chat completion request

func (*Client) Rerank

func (c *Client) Rerank(ctx context.Context, query string, documents []types.Document, criteria string) ([]float64, error)

Rerank scores documents by relevance to the query using Anthropic's Beta Messages API with structured outputs. It returns relevance scores in the same order as input documents.

Directories

Path Synopsis
Package federation builds the Anthropic Workload Identity Federation pieces (identity-token providers and SDK request options) from a typed latest.AuthConfig.
Package federation builds the Anthropic Workload Identity Federation pieces (identity-token providers and SDK request options) from a typed latest.AuthConfig.
Package vertex provides an Anthropic client for Claude models hosted on Google Cloud's Vertex AI.
Package vertex provides an Anthropic client for Claude models hosted on Google Cloud's Vertex AI.

Jump to

Keyboard shortcuts

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