Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: bedrockLLMAgent, streaming tool use, multiple tool_use objects can't be JSON.parse()'d #231

Open
bryan-elliot-kimono opened this issue Feb 12, 2025 · 0 comments
Labels
bug Something isn't working triage

Comments

@bryan-elliot-kimono
Copy link

bryan-elliot-kimono commented Feb 12, 2025

Expected Behaviour

If a tool is used multiple times by a bedrockLLMAgent to answer a query, and the agent is in streaming mode, I'd expect everything to proceed well.

Current Behaviour

If a tool is used more than once in streaming mode (tried with both Nova Pro and Claude 3.5), multiple objects arrive in bedrockLLMAgent.handleStreamingResponse, like this:

{"city":"los angeles","job_title":"accounting"}{"city":"los angeles","building":"32"}

In these cases, the line in handleStreamingResponse which parses it, always fails:

toolBlock.input = JSON.parse(inputString)

The BedrockLLMAgent should see this is happening (somehow), and break up the objects before parsing perhaps? I am not sure what the right behavior here should be, but I am reporting that it isn't working at all in these circumstances.

Code snippet

I don't have a simple code snipper here, my apologies...

Possible Solution

No response

Steps to Reproduce

Create a bedrockLLMAgent which uses either Claude 3.5 or Nova Pro. Create a tool which will search your database according to fields "city", "job_title", or "building" (all of which are optional). Then ask a question such as:

"Tell me the names of employees in los angeles who are either in accounting or whose office is building 32."

You then get multiple tool use (which is correct), as follows:

The user wants information about their employees in Los Angeles who are in accounting or who are in building 32. I need to use the EmployeeTool to search for empoyees based on the city, job title, and building. I will perform two searches: one for employees in accounting and another for employees in building 32.

But I don't believe these tool inputs are ever dispatched to the tool handler, because it crashed upon parsing the inputs.

@bryan-elliot-kimono bryan-elliot-kimono added the bug Something isn't working label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

1 participant