mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
c01467b1f4
Anthropic's streaming treats tool calls as different content parts (streamed back with a different index) from normal content in the `content`. This means that we need to update our chunk-merging logic to handle chunks with multi-part content. The alternative is coerceing Anthropic's responses into a string, but we generally like to preserve model provider responses faithfully when we can. This will also likely be useful for multimodal outputs in the future. This current PR does unfortunately make `index` a magic field within content parts, but Anthropic and OpenAI both use it at the moment to determine order anyway. To avoid cases where we have content arrays with holes and to simplify the logic, I've also restricted merging to chunks in order. TODO: tests CC @baskaryan @ccurme @efriis |
||
---|---|---|
.. | ||
__init__.py | ||
ai.py | ||
base.py | ||
chat.py | ||
function.py | ||
human.py | ||
system.py | ||
tool.py | ||
utils.py |