mirror of
https://github.com/BerriAI/litellm.git
synced 2026-12-05 01:59:27 +00:00
* fix(ollama_chat): split a replayed tool call whose arguments glue JSON objects Before #49183, ollama_chat streaming gave every parallel tool call index 0, so clients like Codex merged them into one call whose arguments hold several JSON objects and kept it in the session history. Replaying that history answered 500 and, since #49183, 400 on every later turn, so the session stayed stuck after upgrading. The replay now splits such arguments into one Ollama tool call per object, gives each extra call an id derived from the original, and copies the matching tool result to every derived id, the same way the Anthropic and Bedrock paths already do. Identical repeats collapse to one call, and non-object or trailing data still answers 400. The split id helpers in factory.py become public so the Ollama transform can reuse them. Based on the direction of #54358 by @elinacse. * test(ollama_chat): cover braces inside a string value and a glued call outside an assistant turn * fix(ollama_chat): answer 400 for a glued tool call without an id * fix(ollama_chat): keep a glued call without an id as one call when its objects are all the same * fix(ollama_chat): forward a tool id that is not a string instead of failing with a 500 The split-id lookups added for glued tool calls used the id as a dict key, so a tool result whose tool_call_id is a list, or a glued call whose id is a list, raised TypeError and answered 500. They now take only string ids, so those requests reach Ollama or answer 400 as they did before this change |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_ollama_chat_transformation.py | ||
| test_ollama_completion_transformation.py | ||
| test_ollama_embedding.py | ||
| test_ollama_model_info.py | ||
| test_ollama_text_completion.py | ||