Skip to navigation

setInferenceParams

View as MarkdownOpen in Claude

Update Bedrock inference parameters. Only the arguments you pass are changed; an argument left undefined keeps its current value.

Parameters

temperature
number | string

Generation temperature. Range: 0 to 2. A numeric string is converted, and a SWML variable reference such as '${temperature}' is kept; anything else throws and changes nothing.

topP
number | string

Nucleus sampling parameter. Range: 0 to 1. A numeric string is converted, and a SWML variable reference is kept; anything else throws and changes nothing.

maxTokens
number | string

Maximum tokens to generate, an integer or a numeric string. Sent in the prompt as max_tokens, but the platform’s Bedrock session doesn’t apply it.

Returns

BedrockAgent — Returns this for method chaining.

Example

import { BedrockAgent } from '@signalwire/sdk';
const agent = new BedrockAgent({
name: 'bedrock-assistant',
route: '/assistant',
systemPrompt: 'You are a helpful assistant.',
});
agent.setInferenceParams(0.3, 0.95, 2048);