mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-21 00:21:49 +00:00
Merge remote-tracking branch 'origin/litellm_remove_brittle_price_pinning_tests' into litellm_remove_brittle_price_pinning_tests
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> # Conflicts: # tests/test_litellm/llms/parallel_ai/test_parallel_ai_search.py # tests/test_litellm/proxy/common_utils/test_prompt_cache_pricing.py # tests/test_litellm/proxy/test_proxy_utils.py
This commit is contained in:
commit
b054d54bee
2 changed files with 17 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import asyncio
|
||||
import contextlib
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
|
|
@ -1218,7 +1219,8 @@ async def test_async_success_handler_truncates_large_base64_off_the_event_loop(m
|
|||
original_scan = logging_utils._truncate_base64_in_string
|
||||
|
||||
def recording_scan(value: str) -> str:
|
||||
scan_threads.append(threading.get_ident())
|
||||
if payload in value:
|
||||
scan_threads.append(threading.get_ident())
|
||||
return original_scan(value)
|
||||
|
||||
monkeypatch.setattr(logging_utils, "_truncate_base64_in_string", recording_scan)
|
||||
|
|
@ -1229,6 +1231,11 @@ async def test_async_success_handler_truncates_large_base64_off_the_event_loop(m
|
|||
|
||||
class CaptureLogger(CustomLogger):
|
||||
async def async_log_success_event(self, kwargs, response_obj, start_time, end_time):
|
||||
logged_messages: Final = json.dumps(
|
||||
kwargs.get("standard_logging_object", {}).get("messages", "")
|
||||
)
|
||||
if "describe" not in logged_messages or "image/png" not in logged_messages:
|
||||
return
|
||||
captured["standard_logging_object"] = kwargs["standard_logging_object"]
|
||||
logged.set()
|
||||
|
||||
|
|
@ -1249,9 +1256,9 @@ async def test_async_success_handler_truncates_large_base64_off_the_event_loop(m
|
|||
)
|
||||
await asyncio.wait_for(logged.wait(), timeout=10)
|
||||
|
||||
logged_url = captured["standard_logging_object"]["messages"][0]["content"][1]["image_url"]["url"]
|
||||
assert "base64_data truncated" in logged_url
|
||||
assert payload not in logged_url
|
||||
serialized: Final = json.dumps(captured["standard_logging_object"]["messages"])
|
||||
assert "base64_data truncated" in serialized
|
||||
assert payload not in serialized
|
||||
assert scan_threads
|
||||
assert loop_thread not in scan_threads
|
||||
|
||||
|
|
@ -3190,7 +3197,8 @@ async def test_non_streaming_computes_standard_logging_object_once():
|
|||
mock_response="Hello, world!",
|
||||
)
|
||||
await asyncio.sleep(1)
|
||||
assert mock_payload.call_count == 1
|
||||
own_calls: Final = [call for call in mock_payload.call_args_list if "codex-mini-latest" in str(call)]
|
||||
assert len(own_calls) == 1
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
|
|
|||
|
|
@ -465,9 +465,10 @@ class TestParallelAISearch:
|
|||
max_results=max_results,
|
||||
)
|
||||
|
||||
rate: Final = litellm.model_cost[
|
||||
{"fast": "parallel_ai/search-fast", "turbo": "parallel_ai/search-turbo"}.get(mode, "parallel_ai/search")
|
||||
]["input_cost_per_query"]
|
||||
pricing_model: Final = {"fast": "parallel_ai/search-fast", "turbo": "parallel_ai/search-turbo"}.get(
|
||||
mode, "parallel_ai/search"
|
||||
)
|
||||
rate: Final = litellm.model_cost[pricing_model]["input_cost_per_query"]
|
||||
request_count: Final = (
|
||||
sum(item["count"] for item in usage if item["name"] == "sku_search") if usage is not None else 1
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue