Documentation
¶
Overview ¶
anthropic implements an API client for anthropic (https://docs.anthropic.com/en/api/getting-started)
Index ¶
- func WithCitations() llm.Opt
- func WithEphemeral() llm.Opt
- func WithUser(v string) llm.Opt
- type Client
- func (anthropic *Client) GetModel(ctx context.Context, name string) (llm.Model, error)
- func (anthropic *Client) ListModels(ctx context.Context) ([]llm.Model, error)
- func (anthropic *Client) Messages(ctx context.Context, context llm.Context, opts ...llm.Opt) (*Response, error)
- func (anthropic *Client) Model(ctx context.Context, model string) llm.Model
- func (anthropic *Client) Models(ctx context.Context) ([]llm.Model, error)
- func (*Client) Name() string
- type Content
- type ContentAttachment
- type ContentText
- type ContentTool
- type ContentToolResult
- type MessageMeta
- type Metrics
- type ModelMeta
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithCitations ¶
func WithEphemeral ¶
Types ¶
type Client ¶
func (*Client) ListModels ¶
List models
type Content ¶
type Content struct { Type string `json:"type"` // image, document, text, tool_use ContentText ContentAttachment *ContentTool ContentToolResult CacheControl *cachecontrol `json:"cache_control,omitempty"` // ephemeral }
func NewTextContent ¶
Return a Content object with text content
func NewToolResultContent ¶
func NewToolResultContent(v llm.ToolResult) *Content
Return a Content object with tool result
type ContentAttachment ¶
type ContentAttachment struct { Title string `json:"title,omitempty"` // title of the document Context string `json:"context,omitempty"` // context of the document Citations *contentcitation `json:"citations,omitempty"` // citations of the document Source *contentsource `json:"source,omitempty"` // image or document content }
type ContentText ¶
type ContentText struct {
Text string `json:"text,omitempty"` // text content
}
type ContentTool ¶
type ContentToolResult ¶
type MessageMeta ¶
Message with text or object content
func (MessageMeta) String ¶
func (m MessageMeta) String() string
func (MessageMeta) Text ¶
func (m MessageMeta) Text() string
type Metrics ¶
type Metrics struct { CacheCreationInputTokens uint `json:"cache_creation_input_tokens,omitempty"` CacheReadInputTokens uint `json:"cache_read_input_tokens,omitempty"` InputTokens uint `json:"input_tokens,omitempty"` OutputTokens uint `json:"output_tokens,omitempty"` }
Metrics
type ModelMeta ¶
type ModelMeta struct { Name string `json:"id"` Description string `json:"display_name,omitempty"` Type string `json:"type,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` }
ModelMeta is the metadata for an anthropic model
Click to show internal directories.
Click to hide internal directories.