mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
test(responses): align merged choice coverage with main
This commit is contained in:
parent
834ab664cd
commit
8c1e8510e0
2 changed files with 6 additions and 23 deletions
|
|
@ -745,14 +745,12 @@ class LiteLLMResponsesTransformationHandler(CompletionTransformationBridge):
|
|||
last_msg_choice.message.content = ""
|
||||
last_msg_choice.finish_reason = "tool_calls"
|
||||
needs_reasoning_content_backfill = (
|
||||
reasoning_content is not None
|
||||
and getattr(last_msg_choice.message, "reasoning_content", None) is None
|
||||
reasoning_content is not None and getattr(last_msg_choice.message, "reasoning_content", None) is None
|
||||
)
|
||||
if needs_reasoning_content_backfill:
|
||||
last_msg_choice.message.reasoning_content = reasoning_content
|
||||
needs_reasoning_items_backfill = (
|
||||
pending_reasoning_item is not None
|
||||
and getattr(last_msg_choice.message, "reasoning_items", None) is None
|
||||
pending_reasoning_item is not None and getattr(last_msg_choice.message, "reasoning_items", None) is None
|
||||
)
|
||||
if needs_reasoning_items_backfill:
|
||||
last_msg_choice.message.reasoning_items = cast(
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
import json
|
||||
import os
|
||||
import unittest
|
||||
from typing import TYPE_CHECKING, Final, List, Literal, Optional, Tuple, get_args
|
||||
from unittest.mock import ANY, MagicMock, Mock, patch
|
||||
from typing import TYPE_CHECKING, Final, Literal, get_args
|
||||
from unittest.mock import MagicMock, Mock, patch
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
|
@ -1590,20 +1589,6 @@ def test_map_reasoning_effort_adds_summary_detailed(monkeypatch):
|
|||
assert result_dict["effort"] == "high"
|
||||
assert result_dict["summary"] == "custom_summary"
|
||||
|
||||
# Test 5: every REASONING_EFFORT level reaches the provider, and anything else (a typo, an
|
||||
# unshipped level, "default") is dropped so the request still succeeds at the provider default
|
||||
from litellm.types.llms.openai import Reasoning
|
||||
|
||||
for effort in ("max", "xhigh", "none"):
|
||||
result_passthrough = handler._map_reasoning_effort(effort)
|
||||
assert result_passthrough == Reasoning(effort=effort)
|
||||
for dropped in ("ultra", "hgih", "unknown_value", "", "default"):
|
||||
assert handler._map_reasoning_effort(dropped) is None
|
||||
|
||||
print(
|
||||
"✓ All reasoning_effort behaviors work correctly with flag/env var control"
|
||||
)
|
||||
|
||||
finally:
|
||||
# Restore original values
|
||||
litellm.reasoning_auto_summary = original_flag
|
||||
|
|
@ -4011,8 +3996,8 @@ async def test_acompletion_bridge_normalizes_tool_choice_on_the_wire(
|
|||
|
||||
|
||||
def _make_incomplete_responses_api_response(
|
||||
incomplete_reason: Optional[str],
|
||||
output: "List[ResponseOutputItem]",
|
||||
incomplete_reason: str | None,
|
||||
output: "list[ResponseOutputItem]",
|
||||
status: Literal["completed", "incomplete"] = "incomplete",
|
||||
empty_incomplete_details: bool = False,
|
||||
) -> "ResponsesAPIResponse":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue