claude

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ANTHROPIC_BETA = "tools-2024-04-04"
View Source
const ANTHROPIC_VERSION = "2023-06-01"
View Source
const MODULE_NAME = "claude"
View Source
const URL = "https://api.anthropic.com"

Variables

View Source
var ModelsList = map[string]*Model{
	"opus": {
		Name:            "claude-3-opus-20240229",
		MaxOutputTokens: 4096,
	},
	"sonnet": {
		Name:            "claude-3-sonnet-20240229",
		MaxOutputTokens: 4096,
	},
	"haiku": {
		Name:            "claude-3-haiku-20240307",
		MaxOutputTokens: 4096,
	},
}

Functions

This section is empty.

Types

type Claude

type Claude struct {
	// contains filtered or unexported fields
}

Configuration structure.

func New

func New(opts ...func(*Claude)) (*Claude, error)

func (*Claude) Do

func (c *Claude) Do(url string, jsonData []byte) (*[]byte, error)

func (*Claude) GetHeaders added in v0.1.0

func (c *Claude) GetHeaders() map[string]string

func (*Claude) GetModelMaxOutputTokens

func (c *Claude) GetModelMaxOutputTokens(modelName string) int

func (*Claude) Stream added in v0.1.0

func (c *Claude) Stream(url string, jsonData []byte) (*[]byte, error)

type ErrHTTP

type ErrHTTP struct {
	Err        error
	Msg        string
	URL        string
	Data       *[]byte
	StatusCode int
}

func (*ErrHTTP) Error

func (e *ErrHTTP) Error() string

type ErrMissingAPIKey

type ErrMissingAPIKey struct {
	Err error
	Msg string
}

func (*ErrMissingAPIKey) Error

func (e *ErrMissingAPIKey) Error() string

type Model

type Model struct {
	Name            string `json:"name"`
	MaxOutputTokens int    `json:"max_output_tokens"`
}

type Option

type Option func(config *Claude)

func WithAPIKey

func WithAPIKey(apikey string) Option

func WithLogger

func WithLogger(log *slog.Logger) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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