Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/llm_translation/reasoning_effort_grid/grid_spec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from dataclasses import dataclass, field
from typing import Dict, FrozenSet, List, Optional, Tuple


OMIT = object()


Expand All @@ -22,6 +21,7 @@ class ModelEntry:
extra_params: Tuple[Tuple[str, str], ...] = field(default_factory=tuple)
required_env: FrozenSet[str] = field(default_factory=frozenset)
caps: FrozenSet[str] = field(default_factory=frozenset)
fail_reason: Optional[str] = None
bedrock_effort_ceiling: Optional[str] = None

def params(self) -> Dict[str, str]:
Expand Down Expand Up @@ -234,6 +234,12 @@ def expected(model: ModelEntry, effort: str) -> CellExpectation:
extra_params=(("aws_region_name", "us-east-1"),),
required_env=_BEDROCK_REQ,
caps=_CAPS_OPUS_4_7,
fail_reason=(
"claude-opus-4-7 is not entitled on the Bedrock CI account "
"888602223428 (model access requires an AWS Sales request, not "
"self-serve); this cell fails on purpose so it stays loud in CI. "
"Remove this fail_reason once access is granted."
),
),
ModelEntry(
alias="bedrock-claude-opus-4-6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
all_cells,
)


_PROMPT_MESSAGES: List[Dict[str, str]] = [
{"role": "user", "content": "Step by step, calculate 47 * 53. Show your work."}
]
Expand Down Expand Up @@ -168,6 +167,9 @@ async def test_reasoning_effort_grid(
if skip_reason:
pytest.skip(skip_reason)

if model.fail_reason:
pytest.xfail(model.fail_reason)

if route_name == "bedrock_invoke_messages":
status, exc = await _call_messages(model, effort)
else:
Expand Down
34 changes: 32 additions & 2 deletions tests/logging_callback_tests/test_log_db_redis_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import sys


sys.path.insert(0, os.path.abspath("../.."))

import asyncio
Expand Down Expand Up @@ -59,7 +58,38 @@ async def test_log_db_metrics_success():
assert isinstance(call_args["duration"], float)
assert isinstance(call_args["start_time"], datetime)
assert isinstance(call_args["end_time"], datetime)
assert "function_name" in call_args["event_metadata"]
assert call_args["event_metadata"] is None


@pytest.mark.asyncio
async def test_log_db_metrics_event_metadata_is_safe():
"""event_metadata must surface only the table name, never the raw
kwargs/args which carry live clients (Prisma, OTel spans) and secrets.

Regression guard for #28909: a previous version dumped function_kwargs and
function_args onto the span.
"""
with patch("litellm.proxy.proxy_server.proxy_logging_obj") as mock_proxy_logging:
mock_proxy_logging.service_logging_obj.async_service_success_hook = AsyncMock()

@log_db_metrics
async def db_call(**kwargs):
return "success"

await db_call(
parent_otel_span="test_span",
table_name="LiteLLM_SpendLogs",
token="sk-secret-should-not-leak",
prisma_client=object(),
)
await asyncio.sleep(0)

call_args = (
mock_proxy_logging.service_logging_obj.async_service_success_hook.call_args[
1
]
)
assert call_args["event_metadata"] == {"table_name": "LiteLLM_SpendLogs"}


@pytest.mark.asyncio
Expand Down
Loading