miniclaude

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 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"
	ModelClaudeV10        string = "claude-v1.0"
	ModelClaudeV12        string = "claude-v1.2"
	ModelClaudeInstantV1  string = "claude-instant-v1"
	ModelClaudeInstantV10 string = "claude-instant-v1.0"
)

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