miniclaude

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptHuman = "\n\nHuman:"
	PromptAI    = "\n\nAssistant:"

	// https://docs.anthropic.com/claude/reference/selecting-a-model
	ModelClaudeLatest        = "claude-2"           // latest model family, manually updated
	ModelClaude2             = "claude-2"           // latest major version
	ModelClaude21            = "claude-2.1"         // latest full version
	ModelClaudeInstantLatest = "claude-instant-1"   // latest instant model family, manually updated
	ModelClaudeInstant1      = "claude-instant-1"   // latest instant major version
	ModelClaudeInstant12     = "claude-instant-1.2" // latest instant full version
)

Variables

View Source
var (
	BaseURL                  = "https://api.anthropic.com"
	APIVersion               = "2023-06-01"
	DefaultMaxTokensToSample = 1200
	DefaultStopSequences     = []string{PromptHuman}
)

Functions

func WrapPrompt

func WrapPrompt(human, ai string) string

Types

type Client

type Client struct {
	HTTPClient *http.Client
	C          chan string
	Endpoint   string
	APIKey     string
	APIVersion string
}

func New

func New() *Client

func (*Client) Stream

func (c *Client) Stream(sp *SamplingParameters) error

type Metadata added in v1.13.4

type Metadata struct {
	UserID string `json:"user_id"`
}

type SamplingParameters

type SamplingParameters struct {
	Temperature       *float64          `json:"temperature,omitempty"`
	TopK              *int              `json:"top_k,omitempty"`
	TopP              *float64          `json:"top_p,omitempty"`
	Tags              map[string]string `json:"tags,omitempty"`
	Prompt            string            `json:"prompt"`
	Model             string            `json:"model"`
	StopSequences     []string          `json:"stop_sequences"`
	MaxTokensToSample int               `json:"max_tokens_to_sample"`
	Stream            bool              `json:"stream"`
	Metadata          Metadata          `json:"metadata,omitempty"`
}

func NewSimpleSamplingParameters

func NewSimpleSamplingParameters(prompt string, model string) *SamplingParameters

Jump to

Keyboard shortcuts

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