anthropic

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HumanPrompt = "\n\nHuman:"
	AIPrompt    = "\n\nAssistant:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(apiKey string) *Client

func (*Client) Complete

func (c *Client) Complete(ctx context.Context, request *CompletionRequest) (*CompletionResponse, error)

type CompletionRequest

type CompletionRequest struct {
	Prompt      string            `json:"prompt"`
	Temperature float32           `json:"temperature,omitempty"`
	MaxTokens   int               `json:"max_tokens_to_sample"`
	Stop        []string          `json:"stop_sequences"`
	TopK        int               `json:"top_k,omitempty"`
	TopP        float32           `json:"top_p,omitempty"`
	Model       string            `json:"model"`
	Tags        map[string]string `json:"tags,omitempty"`
	Stream      bool              `json:"stream"`
}

type CompletionResponse

type CompletionResponse struct {
	Completion string `json:"completion"`
	Stop       string `json:"stop"`
	StopReason string `json:"stop_reason"`
	Truncated  bool   `json:"truncated"`
	Exception  string `json:"exception"`
	LogID      string `json:"log_id"`
}

type Options

type Options struct {
	APIUrl  string
	Version string
	SDK     string
}

Jump to

Keyboard shortcuts

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