BedrockLLMClient

class BedrockLLMClient(bedrockClient: BedrockRuntimeClient, moderationGuardrailsSettings: BedrockGuardrailsSettings? = null, clock: Clock = Clock.System) : LLMClient(source)

Creates a new Bedrock LLM client configured with the specified AWS credentials and settings.

Return

A configured LLMClient instance for Bedrock

Parameters

bedrockClient

The runtime client for interacting with Bedrock, highly configurable

clock

A clock used for time-based operations

moderationGuardrailsSettings

Optional settings of the AWS bedrock Guardrails (see AWS documentation ) that would be used for the LLMClient.moderate request

Constructors

Link copied to clipboard
constructor(awsAccessKeyId: String, awsSecretAccessKey: String, settings: BedrockClientSettings = BedrockClientSettings(), clock: Clock = Clock.System)

Creates a new Bedrock LLM client configured with the specified AWS credentials and settings.

constructor(bedrockClient: BedrockRuntimeClient, moderationGuardrailsSettings: BedrockGuardrailsSettings? = null, clock: Clock = Clock.System)

Functions

Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
open suspend fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
open override fun executeStreaming(prompt: Prompt, model: LLModel): Flow<String>
Link copied to clipboard
open suspend override fun moderate(prompt: Prompt, model: LLModel): ModerationResult

Moderates the provided prompt using specified moderation guardrails settings. The method evaluates both input and output of the prompt against guardrails and determines if either is harmful, returning a corresponding result.