mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-24 08:27:50 +00:00
resolves https://github.com/langchain-ai/langchain/issues/23911 When an AIMessageChunk is instantiated, we attempt to parse tool calls off of the tool_call_chunks. Here we add a special-case to this parsing, where `""` will be parsed as `{}`. This is a reaction to how Anthropic streams tool calls in the case where a function has no arguments: ``` {'id': 'toolu_01J8CgKcuUVrMqfTQWPYh64r', 'input': {}, 'name': 'magic_function', 'type': 'tool_use', 'index': 1} {'partial_json': '', 'type': 'tool_use', 'index': 1} ``` The `partial_json` does not accumulate to a valid json string-- most other providers tend to emit `"{}"` in this case. |
||
---|---|---|
.. | ||
__init__.py | ||
ai.py | ||
base.py | ||
chat.py | ||
function.py | ||
human.py | ||
modifier.py | ||
system.py | ||
tool.py | ||
utils.py |