claude

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModelClaudeV2            = "anthropic.claude-v2"
	ModelClaudeV1Dot3        = "anthropic.claude-v1"
	ModelClaudeInstantV1Dot2 = "anthropic.claude-instant-v1"
)

Variables

This section is empty.

Functions

func ListModels

func ListModels() []string

Types

type BedrockRequest

type BedrockRequest 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"`
}

func (*BedrockRequest) FromChatCompletionRequest

func (b *BedrockRequest) FromChatCompletionRequest(req llm.ChatCompletionRequest)

func (*BedrockRequest) Marshal

func (b *BedrockRequest) Marshal() []byte

type BedrockResponse

type BedrockResponse struct {
	Completion string `json:"completion"`
	Stop       string `json:"stop"`
	StopReason string `json:"stop_reason"`
}

func (*BedrockResponse) ToChatCompletionResponse

func (b *BedrockResponse) ToChatCompletionResponse() llm.ChatCompletionResponse

func (*BedrockResponse) ToChatCompletionStreamResponse

func (b *BedrockResponse) ToChatCompletionStreamResponse() llm.ChatCompletionStreamResponse

func (*BedrockResponse) Unmarshal

func (b *BedrockResponse) Unmarshal(resp []byte)

type Claude

type Claude struct {
	*llm.LLM
}

func New

func New(config aws.Config, dao llm.Dao) *Claude

type Client

type Client struct {
	*bedrockruntime.Client
}

func NewClient

func NewClient(config aws.Config) *Client

func (*Client) CreateChatCompletion

func (c *Client) CreateChatCompletion(ctx context.Context, req llm.ChatCompletionRequest) (llm.ChatCompletionResponse, error)

func (*Client) CreateChatCompletionStream

func (c *Client) CreateChatCompletionStream(ctx context.Context, req llm.ChatCompletionRequest, dataChan chan llm.ChatCompletionStreamResponse, errChan chan error)

func (*Client) ListModels

func (c *Client) ListModels() []string

Jump to

Keyboard shortcuts

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