From 432742778a0b43eed9cc72f7619e4b331e7c1c1d Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 16 May 2026 02:58:20 +0000 Subject: [PATCH] fix(reasoning_effort_grid_v4): cleanup unused fixture, parse converse body, guard budget tokens - Remove unused vertex_credentials_path fixture (and now-unused os import) from conftest.py. - Parse Bedrock Converse complete_input_dict (logged as a JSON string by converse_handler.py) before passing to _assert_cell, so dict accessors work uniformly across routes. - Extend _BUDGET_TOKENS with xhigh and max entries so the budget-mode branch in expected() cannot KeyError if a future budget model gains the matching cap. Co-authored-by: Yassin Kortam --- .../test_litellm/reasoning_effort_grid_v4/conftest.py | 10 ---------- .../test_litellm/reasoning_effort_grid_v4/grid_spec.py | 2 ++ .../reasoning_effort_grid_v4/test_grid_v4.py | 6 ++++++ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/test_litellm/reasoning_effort_grid_v4/conftest.py b/tests/test_litellm/reasoning_effort_grid_v4/conftest.py index 5e1a4e0e974..e5f03778568 100644 --- a/tests/test_litellm/reasoning_effort_grid_v4/conftest.py +++ b/tests/test_litellm/reasoning_effort_grid_v4/conftest.py @@ -1,6 +1,5 @@ """Shared fixtures for the reasoning_effort grid v4 e2e suite.""" -import os from typing import Any, Dict, List, Optional import pytest @@ -50,12 +49,3 @@ def wire_capture(): yield capture finally: litellm.callbacks = previous - - -@pytest.fixture(scope="session") -def vertex_credentials_path() -> Optional[str]: - """Resolve a usable Vertex credentials file path or None.""" - path = os.environ.get("GOOGLE_APPLICATION_CREDENTIALS") - if path and os.path.exists(path): - return path - return None diff --git a/tests/test_litellm/reasoning_effort_grid_v4/grid_spec.py b/tests/test_litellm/reasoning_effort_grid_v4/grid_spec.py index 76243fe227b..7ba676118a3 100644 --- a/tests/test_litellm/reasoning_effort_grid_v4/grid_spec.py +++ b/tests/test_litellm/reasoning_effort_grid_v4/grid_spec.py @@ -59,6 +59,8 @@ _BUDGET_TOKENS: Dict[str, int] = { "low": 1024, "medium": 2048, "high": 4096, + "xhigh": 8192, + "max": 16384, } _ADAPTIVE_EFFORT_LABEL: Dict[str, str] = { diff --git a/tests/test_litellm/reasoning_effort_grid_v4/test_grid_v4.py b/tests/test_litellm/reasoning_effort_grid_v4/test_grid_v4.py index 9eec572988b..7e74cf1f2f4 100644 --- a/tests/test_litellm/reasoning_effort_grid_v4/test_grid_v4.py +++ b/tests/test_litellm/reasoning_effort_grid_v4/test_grid_v4.py @@ -18,6 +18,7 @@ required env vars are absent, so PR builds without provider credentials no-op gracefully. """ +import json import os from typing import Any, Dict, List, Optional, Tuple @@ -198,6 +199,11 @@ async def test_reasoning_effort_grid_v4( record = wire_capture.latest() body = record["body"] if record else None + # Bedrock Converse logs `complete_input_dict` as a JSON string (see + # litellm/llms/bedrock/chat/converse_handler.py); parse it so the dict + # accessors in `_assert_cell` work uniformly across routes. + if route_name == "bedrock_converse" and isinstance(body, str): + body = json.loads(body) try: _assert_cell(route_name, body, status, cell)