You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In addition to the minor difference in behavior between the 1P Anthropic and 3P Bedrock Messages endpoint in #565, there is also a difference in how they handle: Assistant as the first role (succeeds on Anthropic but fails on Bedrock):
importAnthropicfrom'@anthropic-ai/sdk';importAnthropicBedrockfrom'@anthropic-ai/bedrock-sdk';constclientAnthropic=newAnthropic();constclientBedrock=newAnthropicBedrock();consthaiku={anthropic: 'claude-3-haiku-20240307',bedrock: 'anthropic.claude-3-haiku-20240307-v1:0',};asyncfunctionassistantFirstRole(client: Anthropic|AnthropicBedrock,model=haiku.anthropic){constresponse=awaitclient.messages.create({max_tokens: 1,stream: false,messages: [{role: 'assistant',content: 'How can I help?'},{role: 'user',content: 'What is the color of the sky? Answer with only one word.'},],
model,});console.log('Response content: ',response.content);}awaitassistantFirstRole(clientAnthropic,haiku.anthropic);// [ { type: 'text', text: 'Blue' } ]awaitassistantFirstRole(clientBedrock,haiku.bedrock);// Error: 400 messages: first message must use the "user" role
The text was updated successfully, but these errors were encountered:
In addition to the minor difference in behavior between the 1P Anthropic and 3P Bedrock
Messages
endpoint in #565, there is also a difference in how they handle:Assistant
as the first role (succeeds on Anthropic but fails on Bedrock):The text was updated successfully, but these errors were encountered: