bedrock

package
v0.0.0-...-befd70e Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BedrockClient

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

BedrockClient represents a client for interacting with AWS Bedrock

func NewBedrockClient

func NewBedrockClient(awsKey string, awsSecret string, config ...ClientConfig) (*BedrockClient, error)

NewBedrockClient creates a new BedrockClient with AWS credentials and optional config

func (*BedrockClient) Messages

func (c *BedrockClient) Messages(prompt string) (string, error)

Messages sends a chat request to Claude AI via AWS Bedrock and returns the response

type BedrockRequest

type BedrockRequest struct {
	AnthropicVersion string    `json:"anthropic_version"`
	Messages         []Message `json:"messages"`
	MaxTokens        int       `json:"max_tokens"`
	Temperature      float64   `json:"temperature"`
	TopP             float64   `json:"top_p"`
	TopK             int       `json:"top_k"`
}

BedrockRequest represents the request structure for Bedrock API

type BedrockResponse

type BedrockResponse struct {
	Content []struct {
		Text string `json:"text"`
	} `json:"content"`
}

BedrockResponse represents the response structure from Bedrock API

type ClientConfig

type ClientConfig struct {
	MaxRequestsPerMinute int
	MaxRetries           int
	InitialRetryDelay    time.Duration
	MaxRetryDelay        time.Duration
	AWSRegion            string
	InferenceProfileARN  string
	MaxParallelRequests  int
}

ClientConfig holds configuration options for the Bedrock client

func DefaultConfig

func DefaultConfig() ClientConfig

DefaultConfig returns the default client configuration

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message represents a single message in the conversation

type RateLimiter

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

RateLimiter handles API request rate limiting

Jump to

Keyboard shortcuts

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