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 ¶
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 NewVertexClient ¶ added in v1.51.0
func NewVertexClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, project, location string, opts ...options.Opt) (*Client, error)
NewVertexClient creates a new Anthropic client that talks to Claude models hosted on Google Cloud's Vertex AI via the Anthropic-native endpoints (`:rawPredict` and `:streamRawPredict`), authenticated with Google Application Default Credentials.
This is required because Anthropic models on Vertex AI do not support the OpenAI-compatible `/chat/completions` endpoint and fail with `FAILED_PRECONDITION: The deployed model does not support ChatCompletions.`
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.
Source Files
¶
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. |