Tool input parsing error with Claude via AWS Bedrock in Agents endpoint #4638
-
What happened?When using the Agents endpoint with Claude via AWS Bedrock and a custom RAG tool, the tool input parsing fails. The error occurs because the input is a plain string, not a JSON object as expected. Root Cause: The JSON.parse(args) is failing because the string "How to write a unit test in XY? Include best practices and examples." is not a valid JSON string. Possible Fix: Modify the code to handle different input types:
If you want, I can create a PR? Thanks for checking. Steps to Reproduce
What browsers are you seeing the problem on?Chrome Relevant log outputSyntaxError: Unexpected token H in JSON at position 0
at JSON.parse (<anonymous>)
at formatAgentMessages (api/app/clients/prompts/formatMessages.js:192:23)
at AgentClient.chatCompletion (api/server/controllers/agents/client.js:482:24) ScreenshotsNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I wrote a note for this that needing to do this might be provider specific. After some testing, other endpoints don't seem to be negatively affected by a potential fix, however json parsing should be attempted first, as a valid json string should be used outright |
Beta Was this translation helpful? Give feedback.
patching here: #4641