I expect the params passed to client.messages.create to be left untouched. But the SDK adds an anthropic_version field, and if the model is invalid, it's reset to undefined:
import AnthropicBedrock from '@anthropic-ai/bedrock-sdk';
import type { MessageCreateParamsNonStreaming } from '@anthropic-ai/sdk/src/resources/messages';
const client = new AnthropicBedrock();
const messageCreateParams: Anthropic.MessageCreateParamsNonStreaming = {
max_tokens: 1,
messages: [{ role: 'user', content: 'What is the meaning of life?' }],
model: 'invalid',
};
try {
await client.messages.create(messageCreateParams); // throws an error
} catch {
}
console.log(`Model is now: ${messageCreateParams.model}`); // undefined
console.log(`Extra field in messageCreateParams: ${messageCreateParams['anthropic_version']}`); // 'bedrock-2023-05-31'
I expect the params passed to
client.messages.create
to be left untouched. But the SDK adds ananthropic_version
field, and if themodel
is invalid, it's reset toundefined
: