claude

package
v0.0.0-...-26c156c Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MIT-0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyResponse = errors.New("empty response")
View Source
var (
	ErrMissingRegion = errors.New("empty region")
)

Functions

This section is empty.

Types

type ConfigOption

type ConfigOption func(*ConfigOptions)

func DontUseHumanAssistantPrompt

func DontUseHumanAssistantPrompt() ConfigOption

func WithBedrockRuntimeClient

func WithBedrockRuntimeClient(client *bedrockruntime.Client) ConfigOption

func WithModel

func WithModel(modelID string) ConfigOption

type ConfigOptions

type ConfigOptions struct {
	DontUseHumanAssistantPrompt bool
	BedrockRuntimeClient        *bedrockruntime.Client
	ModelID                     string
}

type LLM

type LLM struct {
	CallbacksHandler callbacks.Handler
	// contains filtered or unexported fields
}

func New

func New(region string, options ...ConfigOption) (*LLM, error)

func (*LLM) Call

func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)

func (*LLM) Generate

func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error)

func (*LLM) GeneratePrompt

func (o *LLM) GeneratePrompt(ctx context.Context, prompts []schema.PromptValue, options ...llms.CallOption) (llms.LLMResult, error)

func (*LLM) GetNumTokens

func (o *LLM) GetNumTokens(text string) int

type Request

type Request struct {
	Prompt            string   `json:"prompt"`
	MaxTokensToSample int      `json:"max_tokens_to_sample"`
	Temperature       float64  `json:"temperature,omitempty"`
	TopP              float64  `json:"top_p,omitempty"`
	TopK              int      `json:"top_k,omitempty"`
	StopSequences     []string `json:"stop_sequences,omitempty"`
}

type Response

type Response struct {
	Completion string `json:"completion"`
}

func ProcessStreamingOutput

func ProcessStreamingOutput(output *bedrockruntime.InvokeModelWithResponseStreamOutput, handler func(ctx context.Context, chunk []byte) error) (Response, error)

Jump to

Keyboard shortcuts

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