anthropic

package
v0.0.0-...-bf48d59 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Models = map[string]ModelConfig{
	"ClaudeSonnet": {
		Name:           "claude-3-5-sonnet-latest",
		SupportsVision: true,
		MaxTokens:      8192,
		Description: `The upgraded Claude 3.5 Sonnet is now state-of-the-art 
									for a variety of tasks including real-world software engineering,
									enhanced agentic capabilities, and computer use.`,
	},
	"ClaudeHaiku": {
		Provider:       "anthropic",
		Name:           "claude-3-5-haiku-latest",
		SupportsVision: false,
		MaxTokens:      8192,
		Description: `Claude 3 Haiku is Anthropic's fastest vision and text model 
									for near-instant responses to simple queries, meant for seamless
									AI experiences mimicking human interactions.`,
	},
}

Functions

func Authenticate

func Authenticate() (token string, err error)

func Completion

func Completion(ctx context.Context, token string, model ModelConfig, prompt Prompt) (io.Reader, error)

Types

type Anthropic

type Anthropic struct {
	Token string
	Model ModelConfig
}

func NewAnthropic

func NewAnthropic(token string) *Anthropic

type ChatMessage

type ChatMessage struct {
	Role  Role        `json:"role"`
	Parts MessagePart `json:"parts"`
}

type DataKind

type DataKind int

DataKind represents the type of data contained in the []byte

const (
	DataKindUnknown DataKind = iota
	DataKindImage
	DataKindText
)

type ImagePayload

type ImagePayload struct {
	Type   string `json:"type"`
	Source struct {
		Type      string `json:"type"`
		MediaType string `json:"media_type"`
		Data      string `json:"data"`
	} `json:"source"`
}

type Message

type Message struct {
	Role    Role `json:"role"`
	Content any  `json:"content"`
}

type MessagePart

type MessagePart struct {
	Text string `json:"text,omitempty"`
}

type ModelConfig

type ModelConfig struct {
	Provider       string
	Name           string
	SupportsVision bool
	Description    string
	MaxTokens      int
}

type Prompt

type Prompt interface {
	GetPurpose() string
	GetHistory() ([]string, []string)
	GetQuestion() string
	GetReferences() [][]byte
}

type Role

type Role string
var (
	User Role = "USER"
	Bot  Role = "ASSISTANT"
)

Jump to

Keyboard shortcuts

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