mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(streaming): preserve reasoning_details chunks in stream wrapper and proxy serializer (#48401) * test(streaming): cover OpenRouter chunks that carry only reasoning_details end to end Replace the predicate-level test with a stream test in the mapped test file. It feeds OpenRouter SSE frames through the OpenRouter chunk parser and CustomStreamWrapper, sync and async, and checks that the signature and encrypted reasoning_details pieces reach the caller * fix(anthropic): keep OpenRouter reasoning_details signatures in /v1/messages streams Keeping reasoning_details-only chunks in the stream let them reach the /v1/messages adapter, which opened an empty text block before tool calls and still sent an empty signature_delta The adapter now reads the signature from reasoning_details into the open thinking block, and drops reasoning_details-only chunks that carry nothing it can render, such as Gemini's encrypted reasoning * fix(anthropic): split bundled reasoning_details signatures from text in /v1/messages streams A chunk that carries a reasoning_details signature next to answer text or thinking text now splits into separate pieces, so the text block keeps its text and the signature stays in its thinking block * fix(anthropic): keep /v1/messages streams unchanged by OpenRouter reasoning_details pieces /v1/messages no longer turns a reasoning_details signature into a signature_delta. The proxy replays thinking blocks to OpenRouter as thinking_blocks, which OpenRouter ignores, so a streamed signature gave no replay benefit and two signed blocks could merge under one signature A frame that holds only reasoning_details /v1/messages cannot show is skipped, so the stream wrapper fix opens no empty block before a tool call * fix(streaming): count reasoning_details as sent output for fallback and /v1/completions A stream that already sent a reasoning_details piece now counts as started for mid-stream fallback and continuation, the same as reasoning_content, so another deployment's answer is never spliced in after it. /v1/completions frames carry the reasoning_details piece the same way they carry reasoning_content, instead of turning it into an empty text frame. * fix(anthropic): skip a reasoning_details-only /v1/messages frame only when it has one choice --------- Co-authored-by: Charlie Freeman <243496084+cf3901646@users.noreply.github.com> Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| batches | ||
| chat | ||
| files | ||
| messages | ||
| pass_through | ||
| __init__.py | ||
| anthropic_docs_refusal.py | ||
| test_anthropic_common_utils.py | ||
| test_anthropic_count_tokens_transformation.py | ||
| test_anthropic_files_and_batches.py | ||
| test_anthropic_output_format_filter.py | ||
| test_anthropic_prompt_cache_prediction.py | ||
| test_anthropic_prompt_cache_pricing.py | ||
| test_anthropic_reasoning_effort.py | ||
| test_anthropic_schema_filter.py | ||
| test_anthropic_structured_output.py | ||
| test_anthropic_wif.py | ||
| test_azure_ai_cache_pricing.py | ||
| test_cost_calculation_dict_safety.py | ||
| test_count_tokens_oauth.py | ||
| test_message_sanitization.py | ||
| test_messages_http_error_retry_cases.py | ||