mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
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 <yassin@berri.ai>
This commit is contained in:
parent
fec4ae69e0
commit
432742778a
3 changed files with 8 additions and 10 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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] = {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue