Documentation ¶
Index ¶
Constants ¶
View Source
const ( RoleUser = "user" RoleAssistant = "assistant" RoleSystem = "system" )
View Source
const MaxTokensAnthropicSonnet35 = "max-tokens-3-5-sonnet-2024-07-15" //nolint:gosec // This is not a sensitive value.
MaxTokensAnthropicSonnet35 is the header value for specifying the maximum number of tokens when using the Anthropic Sonnet 3.5 model.
Variables ¶
View Source
var ( ErrEmptyResponse = errors.New("no response") ErrMissingToken = errors.New("missing the Anthropic API key, set it in the ANTHROPIC_API_KEY environment variable") ErrUnexpectedResponseLength = errors.New("unexpected length of response") ErrInvalidContentType = errors.New("invalid content type") ErrUnsupportedMessageType = errors.New("unsupported message type") ErrUnsupportedContentType = errors.New("unsupported content type") )
Functions ¶
This section is empty.
Types ¶
type LLM ¶
func (*LLM) GenerateContent ¶
func (o *LLM) GenerateContent(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
GenerateContent implements the Model interface.
type Option ¶
type Option func(*options)
func WithAnthropicBetaHeader ¶
WithAnthropicBetaHeader adds the Anthropic Beta header to support extended options.
func WithBaseURL ¶
WithBaseUrl passes the Anthropic base URL to the client. If not set, the default base URL is used.
func WithHTTPClient ¶
func WithHTTPClient(client anthropicclient.Doer) Option
WithHTTPClient allows setting a custom HTTP client. If not set, the default value is http.DefaultClient.
func WithLegacyTextCompletionsAPI ¶
func WithLegacyTextCompletionsAPI() Option
WithLegacyTextCompletionsAPI enables the use of the legacy text completions API.
type ToolResult ¶
Click to show internal directories.
Click to hide internal directories.