anthropic

package
v1.3.12 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ClaudeURL = "https://api.anthropic.com/v1/messages"

Variables

View Source
var CLAUDE_DEFAULT = Claude{
	Model:            "claude-3-opus-20240229",
	Url:              ClaudeURL,
	AnthropicVersion: "2023-06-01",
	AnthropicBeta:    "tools-2024-04-04",
	Temperature:      0.7,
	MaxTokens:        1024,
	TopP:             -1,
	TopK:             -1,
	StopSequences:    make([]string, 0),
}

Functions

This section is empty.

Types

type Claude

type Claude struct {
	Model            string   `json:"model"`
	MaxTokens        int      `json:"max_tokens"`
	Url              string   `json:"url"`
	AnthropicVersion string   `json:"anthropic-version"`
	AnthropicBeta    string   `json:"anthropic-beta"`
	Temperature      float64  `json:"temperature"`
	TopP             float64  `json:"top_p"`
	TopK             int      `json:"top_k"`
	StopSequences    []string `json:"stop_sequences"`
	// contains filtered or unexported fields
}

func (*Claude) RegisterTool added in v1.2.7

func (c *Claude) RegisterTool(tool tools.AiTool)

func (*Claude) Setup added in v1.2.0

func (c *Claude) Setup() error

func (*Claude) StreamCompletions added in v1.2.0

func (c *Claude) StreamCompletions(ctx context.Context, chat models.Chat) (chan models.CompletionEvent, error)

type ClaudeMessage added in v1.2.7

type ClaudeMessage struct {
	ID    string      `json:"id,omitempty"`
	Input tools.Input `json:"input,omitempty"`
	Name  string      `json:"name,omitempty"`
	Text  string      `json:"text,omitempty"`
	Type  string      `json:"type"`
}

type ClaudeResponse added in v1.2.7

type ClaudeResponse struct {
	Content      []ClaudeMessage `json:"content"`
	ID           string          `json:"id"`
	Model        string          `json:"model"`
	Role         string          `json:"role"`
	StopReason   string          `json:"stop_reason"`
	StopSequence any             `json:"stop_sequence"`
	Type         string          `json:"type"`
	Usage        TokenInfo       `json:"usage"`
}

type ContentBlock added in v1.3.12

type ContentBlock struct {
	Type  string                 `json:"type"`
	ID    string                 `json:"id"`
	Name  string                 `json:"name"`
	Input map[string]interface{} `json:"input"`
}

type ContentBlockDelta

type ContentBlockDelta struct {
	Type  string `json:"type"`
	Index int    `json:"index"`
	Delta Delta  `json:"delta"`
}

type ContentBlockSuper added in v1.3.12

type ContentBlockSuper struct {
	Type         string       `json:"type"`
	Index        int          `json:"index"`
	ContentBlock ContentBlock `json:"content_block"`
}

type Delta

type Delta struct {
	Type        string `json:"type"`
	Text        string `json:"text,omitempty"`
	PartialJson string `json:"partial_json,omitempty"`
}

type Root added in v1.3.12

type Root struct {
	Type         string       `json:"type"`
	Index        int          `json:"index"`
	ContentBlock ContentBlock `json:"content_block"`
}

type TokenInfo added in v1.2.7

type TokenInfo struct {
	InputTokens  int `json:"input_tokens"`
	OutputTokens int `json:"output_tokens"`
}

Jump to

Keyboard shortcuts

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