anthropics / anthropic-sdk-typescript

Access to Anthropic's safety-first language model APIs
https://www.npmjs.com/package/@anthropic-ai/sdk
MIT License
735 stars 79 forks source link

AWS Bedrock - extraneous key [disable_parallel_tool_use] is not permitted #592

Open ShantanuNair opened 2 weeks ago

ShantanuNair commented 2 weeks ago

Bedrock SDK client cannot take in tool_choice param for disable_parallel_tool_use. I am on latest anthropic sdk 0.32.1 and bedrock package 0.11.2.

Current Behavior:

Supplying the field returns:

Message: 400 Malformed input request: #: subject must not be valid against schema {"required":["messages"]}#/tool_choice: extraneous key [disable_parallel_tool_use] is not permitted, please reformat your input and try again.

Expected Behavior:

We can set disable parallel tool use in tool_choice.

Reproduction:

const response = await bedrock.messages.create({
  model: modelId,
  temperature,
  system: summaryPrompt,
  tools: [tools.extractSummary],
  tool_choice: {
    name: 'extract_summary',
    type: 'tool',
    disable_parallel_tool_use: true,
  },
  messages: [
    {
      role: 'user',
      content: [
        {
          type: 'text',
          text: `${context}
          Write a summary for above.`,
        },
      ],
    },
  ],
  max_tokens: 7000,
});
litanli commented 4 days ago

Upvoting, could we get a reply to this?