mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* test(e2e): move the Gemini Flash alias off the retired gemini-2.5-flash Google AI Studio now answers 404 for gemini-2.5-flash on new projects, so the e2e aliases move to gemini-3.8-flash. The Vertex alias and every Vertex deployment, batch, and passthrough URL use the global location, because gemini-3.8-flash is only served there 3.8 Flash thinks by default, so the Vertex chat tests send reasoning_effort none with more max_tokens, and the Presidio pre_call tests get the same 512 token room as post_call. The custom pricing override rates are scaled to stay about 100x above the new base price * test(e2e): keep the default Vertex chat request shape and fit 3.8 Flash thinking in the guardrail and cache tests * test(e2e): give the streamed Bedrock post_call test room for 3.8 Flash thinking * test(e2e): keep main's custom pricing override rates main already moved the custom pricing test to Gemini 3.8 Flash with its own rates, so the merge only needed to keep them * test(e2e): give the Vertex tool call test room for default thinking 3.8 Flash thinks by default, so the tool call test gets the same 1024 token cap as the other Vertex chat tests --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
68 lines
2.3 KiB
Python
68 lines
2.3 KiB
Python
from __future__ import annotations
|
|
|
|
import time
|
|
|
|
import pytest
|
|
from prometheus_client.parser import text_string_to_metric_families
|
|
|
|
from e2e_config import unique_marker
|
|
from e2e_metadata import Domain, Mode, Provider, Route, Subject, meta
|
|
from lifecycle import ResourceManager
|
|
from logging_client import LoggingClient
|
|
|
|
pytestmark = pytest.mark.e2e
|
|
|
|
DRIVER_MODEL = "gemini-3.8-flash"
|
|
QUEUE_TIME_METRIC = "litellm_request_queue_time_seconds"
|
|
ALIAS_LABEL = "api_key_alias"
|
|
|
|
|
|
def _observation_count(exposition: str, alias: str) -> float | None:
|
|
return next(
|
|
(
|
|
sample.value
|
|
for family in text_string_to_metric_families(exposition)
|
|
for sample in family.samples
|
|
if sample.name == f"{QUEUE_TIME_METRIC}_count" and sample.labels.get(ALIAS_LABEL) == alias
|
|
),
|
|
None,
|
|
)
|
|
|
|
|
|
class TestPrometheusRequestQueueTime:
|
|
@pytest.mark.covers("logging.prometheus.success.records_queue_time")
|
|
@meta(
|
|
Subject(
|
|
domain=Domain.OBSERVABILITY,
|
|
route=Route.METRICS,
|
|
providers=(Provider.GEMINI,),
|
|
models=(DRIVER_MODEL,),
|
|
mode=Mode.NONSTREAM,
|
|
)
|
|
)
|
|
def test_queue_time_histogram_records_an_observation(
|
|
self, client: LoggingClient, resources: ResourceManager
|
|
) -> None:
|
|
alias = f"e2e-queue-time-{unique_marker()}"
|
|
key = client.key_with_alias(alias, models=[DRIVER_MODEL])
|
|
resources.defer(lambda: client.delete_key(key))
|
|
|
|
response = client.chat(key, DRIVER_MODEL, f"reply with one word {alias}")
|
|
assert response.model, f"driver call returned no model: {response}"
|
|
|
|
deadline = time.monotonic() + client.proxy.poll_timeout
|
|
count: float | None = None
|
|
while time.monotonic() < deadline:
|
|
count = _observation_count(client.scrape_metrics(), alias)
|
|
if count is not None and count > 0:
|
|
break
|
|
time.sleep(client.proxy.poll_interval)
|
|
|
|
assert count is not None, (
|
|
f"{QUEUE_TIME_METRIC} has no series for {ALIAS_LABEL}={alias}; the histogram was "
|
|
f"never observed for a request that succeeded"
|
|
)
|
|
assert count > 0, (
|
|
f"{QUEUE_TIME_METRIC} series for {alias} exists but recorded {count} observations; "
|
|
f"the metric is registered yet never written"
|
|
)
|