Skip to content

Conversation

@Rakesh-Polepeddi
Copy link
Contributor

@Rakesh-Polepeddi Rakesh-Polepeddi commented Oct 7, 2025

This PR fixes two issues while using granite with A2A and langraph:

  1. Not valid json string for AI message for react agent using A2A.
  2. Output of AI message is not always a json string.

role:::: assistant
raw_tool_call:::: {'id': 'chatcmpl-tool-089a4f22f4534962aee2692975da9f3c', 'type': 'function', 'function': {'name': 'ibmcloud_resources', 'arguments': '"{\n \"output\": \"json\"\n}"'}}

raw tool call with which convert str of json to string content::::
tool_calls:::: [{'name': 'ibmcloud_resources', 'args': '{\n "output": "json"\n}', 'id': 'chatcmpl-tool-089a4f22f4534962aee2692975da9f3c', 'type': 'tool_call'}] invalid_tool_calls:::: []

Similarly in response It gives a dict string instead of json string

role:::: assistant
raw_tool_call:::: {'id': 'chatcmpl-tool-7b2cd9cbd4904da9b8c787b34056111d', 'type': 'function', 'function': {'name': 'ResponseFormat', 'arguments': "{'message': '', 'status': 'completed'}"}}
content::::
tool_calls:::: []
invalid_tool_calls:::: [{'name': 'ResponseFormat', 'args': "{'message': '
***', 'type': 'invalid_tool_call'}]

This PR fixes two issues:

role::::  assistant
raw_tool_call:::: {'id': 'chatcmpl-tool-089a4f22f4534962aee2692975da9f3c', 'type': 'function', 'function': {'name': 'ibmcloud_resources', 'arguments': '"{\\n  \\"output\\": \\"json\\"\\n}"'}}

raw tool call with which convert str of json to string
content::::  
tool_calls::::  [{'name': 'ibmcloud_resources', 'args': '{\n  "output": "json"\n}', 'id': 'chatcmpl-tool-089a4f22f4534962aee2692975da9f3c', 'type': 'tool_call'}]
invalid_tool_calls::::  []

Similarly in response It gives a dict string instead of json string

role::::  assistant
raw_tool_call:::: {'id': 'chatcmpl-tool-7b2cd9cbd4904da9b8c787b34056111d', 'type': 'function', 'function': {'name': 'ResponseFormat', 'arguments': "{'message': '*******', 'status': 'completed'}"}}
content::::  
tool_calls::::  []
invalid_tool_calls::::  [{'name': 'ResponseFormat', 'args': "{'message': '**********', 'type': 'invalid_tool_call'}]
@Rakesh-Polepeddi Rakesh-Polepeddi marked this pull request as draft October 7, 2025 14:54
@Rakesh-Polepeddi Rakesh-Polepeddi marked this pull request as ready for review October 7, 2025 14:56
@MateuszOssGit MateuszOssGit merged commit d8cde04 into langchain-ai:main Oct 23, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants