Documentation
¶
Index ¶
Constants ¶
View Source
const ( PromptHuman = "\n\nHuman:" PromptAI = "\n\nAssistant:" // https://docs.anthropic.com/claude/reference/selecting-a-model ModelClaudeLatest = "claude-2" // latest model family, manually updated ModelClaude2 = "claude-2" // latest major version ModelClaude21 = "claude-2.1" // latest full version ModelClaudeInstantLatest = "claude-instant-1" // latest instant model family, manually updated ModelClaudeInstant1 = "claude-instant-1" // latest instant major version ModelClaudeInstant12 = "claude-instant-1.2" // latest instant full version )
Variables ¶
View Source
var ( BaseURL = "https://api.anthropic.com" APIVersion = "2023-06-01" DefaultMaxTokensToSample = 1200 DefaultStopSequences = []string{PromptHuman} )
Functions ¶
func WrapPrompt ¶
Types ¶
type Client ¶
type Client struct {
HTTPClient *http.Client
C chan string
Endpoint string
APIKey string
APIVersion string
}
func (*Client) Stream ¶
func (c *Client) Stream(sp *SamplingParameters) error
type SamplingParameters ¶
type SamplingParameters struct {
Temperature *float64 `json:"temperature,omitempty"`
TopK *int `json:"top_k,omitempty"`
TopP *float64 `json:"top_p,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Prompt string `json:"prompt"`
Model string `json:"model"`
StopSequences []string `json:"stop_sequences"`
MaxTokensToSample int `json:"max_tokens_to_sample"`
Stream bool `json:"stream"`
Metadata Metadata `json:"metadata,omitempty"`
}
func NewSimpleSamplingParameters ¶
func NewSimpleSamplingParameters(prompt string, model string) *SamplingParameters
Click to show internal directories.
Click to hide internal directories.