langchain/libs/core/tests
ccurme 74c7198906
core, anthropic[patch]: support streaming tool calls when function has no arguments (#23915)
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.
2024-07-05 18:57:41 +00:00
..
integration_tests core[patch], langchain[patch]: fix required deps (#14373) 2023-12-07 14:24:58 -08:00
unit_tests core, anthropic[patch]: support streaming tool calls when function has no arguments (#23915) 2024-07-05 18:57:41 +00:00
__init__.py Separate out langchain_core package (#13577) 2023-11-20 13:09:30 -08:00