miniclaude

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PromptHuman = "\n\nHuman:"
	PromptAI    = "\n\nAssistant:"
	MessageDone = "[DONE]"

	ModelClaudeV1              string = "claude-v1"
	ModelClaudeV1_100K         string = "claude-v1-100k"
	ModelClaudeV10             string = "claude-v1.0"
	ModelClaudeV12             string = "claude-v1.2"
	ModelClaudeV13             string = "claude-v1.3"
	ModelClaudeV13_100K        string = "claude-v1.3-100k"
	ModelClaudeInstantV1       string = "claude-instant-v1"
	ModelClaudeInstantV1_100K  string = "claude-instant-v1-100k"
	ModelClaudeInstantV10      string = "claude-instant-v1.0"
	ModelClaudeInstantV11      string = "claude-instant-v1.1"
	ModelClaudeInstantV11_100K string = "claude-instant-v1.1-100k"
)

Variables

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

Functions

func WrapPrompt

func WrapPrompt(human, ai string) string

Types

type Client

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

func New

func New() *Client

func (*Client) Stream

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

type SamplingParameters

type SamplingParameters struct {
	Prompt            string            `json:"prompt"`
	MaxTokensToSample int               `json:"max_tokens_to_sample"`
	StopSequences     []string          `json:"stop_sequences"`
	Model             string            `json:"model"`
	Stream            bool              `json:"stream"`
	Temperature       *float64          `json:"temperature,omitempty"`
	TopK              *int              `json:"top_k,omitempty"`
	TopP              *float64          `json:"top_p,omitempty"`
	Tags              map[string]string `json:"tags,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