bedrock_runtime

package
v1.5.45 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2025 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BedrockRequest

type BedrockRequest struct {
	AdditionalModelRequestFields map[string]interface{} `json:"additionalModelRequestFields"`
	InferenceConfig              InferenceConfig        `json:"inferenceConfig"`
	Messages                     []Message              `json:"messages"`
	System                       []SystemMessage        `json:"system"`
}

BedrockRequest represents the structure of the Bedrock API request body.

func CreateBedrockRequest

func CreateBedrockRequest(maxTokens int, Temperature, TopP float64, messages models.AIChatHistory, systemMessage string) BedrockRequest

type BedrockResponse added in v1.5.42

type BedrockResponse struct {
	Metrics    Metrics `json:"metrics"`
	Output     Output  `json:"output"`
	StopReason string  `json:"stopReason"`
	Usage      Usage   `json:"usage"`
}

func InvokeBedrockConverseAPI

func InvokeBedrockConverseAPI(modelIdentifier string, requestBody BedrockRequest) (*BedrockResponse, error)

type Content

type Content struct {
	Text string `json:"text"`
}

Content represents the content of a message.

type InferenceConfig

type InferenceConfig struct {
	MaxTokens   int     `json:"maxTokens"`
	Temperature float64 `json:"temperature"`
	TopP        float64 `json:"topP"`
}

InferenceConfig defines the inference configurations.

type Message

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

Message represents a single message in the messages array.

func ProcessChatMessages

func ProcessChatMessages(messages models.AIChatHistory) []Message

type Metrics added in v1.5.42

type Metrics struct {
	LatencyMs float64 `json:"latencyMs"`
}

type Output added in v1.5.42

type Output struct {
	Message Message `json:"message"`
}

type SystemMessage

type SystemMessage struct {
	Text string `json:"text"`
}

SystemMessage represents a system-level message.

type Usage added in v1.5.42

type Usage struct {
	InputTokens  int `json:"inputTokens"`
	OutputTokens int `json:"outputTokens"`
	TotalTokens  int `json:"totalTokens"`
}

Jump to

Keyboard shortcuts

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