anthropic

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func NewTextQuerier

func NewTextQuerier(conf text.Configurations) (models.ChatQuerier, error)

NewTextQuerier returns a new Claude querier using the textconfigurations to load the correct model. API key is fetched via environment variable

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"`
	Raw              bool   `json:"raw"`
	// contains filtered or unexported fields
}

func (*Claude) Query

func (c *Claude) Query(ctx context.Context) error

Query performs a streamCompletion and appends the returned message to it's internal chat. Then it stores the internal chat as prevQuery.json, so that it may be used n upcoming queries

func (*Claude) TextQuery

func (c *Claude) TextQuery(ctx context.Context, chat models.Chat) (models.Chat, error)

TextQuery performs a streamCompletion and appends the returned message to it's internal chat. It therefore does not store it to prevQuery.json, and assumes that the calee will deal with storing the chat.

type ContentBlockDelta

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

type Delta

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

Jump to

Keyboard shortcuts

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