data

package
v2.0.0-...-288f5f8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API         string = "https://api.anthropic.com/v1/complete"
	MessagesAPI string = "https://api.anthropic.com/v1/messages"
	UserAgent   string = "" /* 168-byte string literal not displayed */
	SDKVersion  string = "2.1.0"
)
View Source
const (
	UserRole      = "user"
	AssistantRole = "assistant"
)
View Source
const (
	ModelMajorInstant      string = "claude-instant-1"
	ModelMajorClaude       string = "claude-2"
	ModelFullInstant       string = "claude-instant-1.2"
	ModelFullClaude        string = "claude-2.1"
	ModelFullClaude3Sonnet string = "claude-3-sonnet-20240229"
	ModelFullClaude3Opus   string = "claude-3-opus-20240229"
	ModelFullClaude3Haiku  string = "claude-3-haiku-20240307"
)

latest model

View Source
const (
	Model_MajorClaude_1       string = "claude-v1"
	Model_MajorClaude_1_Big   string = "claude-v1-100k"
	Model_FullClaude_1_0      string = "claude-v1.0"
	Model_FullClaude_1_2      string = "claude-v1.2"
	Model_FullClaude_1_3      string = "claude-v1.3"
	Model_FullClaude_1_3_Big  string = "claude-v1.3-100k"
	Model_MajorInstant_1      string = "claude-instant-v1"
	Model_MajorInstant_1_Big  string = "claude-instant-v1-100k"
	Model_FullInstant_1_0     string = "claude-instant-v1.0"
	Model_FullInstant_1_1     string = "claude-instant-1.1"
	Model_FullInstant_1_1_Big string = "claude-instant-v1.1-100k"
	Model_FullClaude_2_0      string = "claude-2.0"
)

old model (Availability not guaranteed)

Variables

View Source
var (
	ErrApiKeyEmpty                   = errors.New("apikey cannot be empty")
	ErrRegionBanned                  = errors.New("region blocked")
	ErrClientIsNil                   = errors.New("client cannot be nil")
	ErrSessionIsNil                  = errors.New("session cannot be nil")
	ErrSessionNotFound               = errors.New("session not found")
	ErrConfigIsNil                   = errors.New("configuration cannot be nil")
	ErrSenderIsNil                   = errors.New("sender cannot be nil")
	ErrPromptHumanEmpty              = errors.New("the value of human cannot be empty")
	ErrPromptCtxEmpty                = errors.New("the value of session cannot be empty")
	ErrPromptEmpty                   = errors.New("the value of prompt cannot be empty")
	ErrPromptMustStartWithUserPrompt = errors.New("the first message must be from user role")
)
View Source
var Client = &fasthttp.Client{
	NoDefaultUserAgentHeader:      true,
	DisableHeaderNamesNormalizing: false,
	Dial:                          dialer(),
}
View Source
var StopSequences []string = []string{"\n\nHuman:"}

Functions

This section is empty.

Types

type ContentItem

type ContentItem struct {
	Text string `json:"text"`
	Type string `json:"type"`
}

ContentItem follows the json object language of Anthropic

type InputMessage

type InputMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type MessageArray

type MessageArray struct {
	Messages []InputMessage `json:"messages"`
	Content  []ContentItem  `json:"content"`
}

MessageArray is a struct representing the requests json objects for the v1/messages API See here: https://docs.anthropic.com/claude/reference/messages_post

func (*MessageArray) Validate

func (mm *MessageArray) Validate() error

type MessageModule

type MessageModule struct {
	Assistant string // returned data (do not modify)
	Human     string // input content
}

Chunked message structure

Jump to

Keyboard shortcuts

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