Skip to content

Add parallel tooling for AWS Bedrock #736

@aabchoo

Description

@aabchoo

Description:

Describe the desired behavior, what scenario it enables and how it
would be used.

Support multiple tool calls within the same response message for bedrock.

    MESSAGES_WITH_PARALLEL_TOOL_RESPONSE = [
        {
            "role": "user",
            "content": "What is the weather in Dallas, Texas and Orlando, Florida in Fahrenheit?",
        },
        {
            "role": "assistant",
            "tool_calls": [
                {
                    "id": "tool-1",
                    "type": "function",
                    "function": {
                        "name": WEATHER_TOOL["function"]["name"],
                        "arguments": '{"city": "Dallas", "state": "TX", '
                        '"unit": "fahrenheit"}',
                    },
                },
                {
                    "id": "tool-2",
                    "type": "function",
                    "function": {
                        "name": WEATHER_TOOL["function"]["name"],
                        "arguments": '{"city": "Orlando", "state": "Fl", '
                        '"unit": "fahrenheit"}',
                    },
                },
            ],
        },
        {
            "role": "tool",
            "tool_call_id": "tool-1`",
            "content": "The weather in Dallas TX is 88 degrees fahrenheit with mostly "
            "cloudy skies and a chance of rain in the evening.",
        },
        {
            "role": "tool",
            "tool_call_id": "tool-2",
            "content": "The weather in Orlando FL is 77 degrees fahrenheit with clear"
            "skies.",
        },
    ]

openai.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'ValidationException:http://internal.amazon.com/coral/com.amazon.bedrock/', 'code': '400', 'message': 'Expected toolResult blocks at messages.2.content for the following Ids: tool-2'}}

[optional Relevant Links:]

Any extra documentation required to understand the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions