each stop sequence must contain non-whitespace, Bedrock Anthropic

This commit is contained in:
Nate Sesti 2024-07-04 09:13:04 -07:00
parent 45c2ec7eee
commit b8b8da842e

View file

@ -113,7 +113,8 @@ class AnthropicClaude3Toolkit implements BedrockModelToolkit {
temperature: options.temperature,
top_p: options.topP,
top_k: options.topK,
stop_sequences: options.stop,
// each stop sequence must contain non-whitespace
stop_sequences: options.stop?.filter((stop) => stop.trim() !== ""),
};
return new InvokeModelWithResponseStreamCommand({
body: new TextEncoder().encode(JSON.stringify(payload)),