mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* fix(responses): bound overlong tool call ids in the chat to responses bridge Chat tool call ids longer than 64 characters were copied verbatim into Responses call_id fields, so OpenAI rejected the request with string too long. transform_request now replaces any such call_id on function and custom tool calls and their outputs with its SHA-256 hex digest, so calls and outputs stay paired across ordinary and replayed history. Shorter ids, non-string ids and other callers of the shared converter are unchanged. * style(responses): drop the call id limit observation comment * fix(responses): bound bridged tool call ids only for endpoints that limit them The chat to Responses bridge hashed every call_id longer than 64 characters before routing finished, so custom endpoints that accept long ids got rewritten ids, and a short id equal to a hash could collide. The bridge request now keeps the caller's ids. The Responses HTTP handlers, sync and async, map them after the provider transform and before signing, only for bridged chat requests whose final URL is OpenAI, a verified Azure host or a standard Bedrock Mantle host. Each distinct overlong id gets a 64-char SHA-256 based value that avoids every short id already in the request, so calls, outputs and replayed history stay paired in any order. * perf(responses): assign bridged call id replacements in linear time Each overlong id copied the reserved set and the growing replacement map, so a request with thousands of distinct overlong ids blocked the event loop for seconds. One request-local taken set now holds the short ids and every claimed replacement, and the replacement map is frozen once. * test(responses): cover a long call id whose retry candidate another long id already claimed * style(responses): remove an unnecessary mutation annotation * test(responses): cover bridged call ids on faked streams and repeated long ids * refactor(responses): reuse the Azure v1 host check for bridged call id limits * fix(responses): bound overlong tool call ids on every bridged chat request The bridge only shortened call ids longer than 64 characters when the final URL was a known OpenAI, Azure or Mantle host, so bridged requests through OpenRouter or a nested LiteLLM proxy still sent the long ids and the OpenAI backend behind them rejected the request. Every Chat to Responses bridged request now gets the same collision safe per request mapping at dispatch. Ids of 64 characters or fewer, native Responses calls and ordinary chat completions are unchanged. * test(responses): answer bridged route requests in the stream mode they ask for --------- Co-authored-by: Joshua Valluru <326636767+joshua-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_accept_encoding.py | ||
| test_aiohttp_cleanup_closed.py | ||
| test_aiohttp_handler.py | ||
| test_aiohttp_so_keepalive.py | ||
| test_aiohttp_transport.py | ||
| test_asgi_handler.py | ||
| test_async_client_cleanup.py | ||
| test_container_handler.py | ||
| test_credential_leak_prevention.py | ||
| test_gemini_session_leak.py | ||
| test_http2_connection_spread.py | ||
| test_http2_graceful_goaway.py | ||
| test_http_handler.py | ||
| test_llm_http_handler.py | ||
| test_mock_transport.py | ||
| test_sse_lines.py | ||