mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
Merge pull request #39804 from BerriAI/litellm_/e2e-wildcard-probe-and-embedding-allowlist
test(e2e): repair the wildcard readiness probe and the semantic auto-router spend assertion
This commit is contained in:
commit
7672399c26
3 changed files with 24 additions and 3 deletions
|
|
@ -851,6 +851,15 @@ class ModelListEntry(BaseModel):
|
||||||
id: str
|
id: str
|
||||||
|
|
||||||
|
|
||||||
|
class ModelsListParams(BaseModel):
|
||||||
|
"""Query for GET /v1/models. A wildcard route such as ``openai/gpt-5.4*`` is
|
||||||
|
listed only under ``return_wildcard_routes``; without it the route is dropped
|
||||||
|
and only its expansions remain, so a readiness poll for the pattern itself
|
||||||
|
never resolves."""
|
||||||
|
|
||||||
|
return_wildcard_routes: bool = True
|
||||||
|
|
||||||
|
|
||||||
class ModelsListResponse(BaseModel):
|
class ModelsListResponse(BaseModel):
|
||||||
"""GET /v1/models on the data plane: the deployments the gateway can actually
|
"""GET /v1/models on the data plane: the deployments the gateway can actually
|
||||||
serve right now. Used to confirm a freshly created model has propagated from
|
serve right now. Used to confirm a freshly created model has propagated from
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ from models import (
|
||||||
ModelMode,
|
ModelMode,
|
||||||
ModelNewBody,
|
ModelNewBody,
|
||||||
ModelNewResponse,
|
ModelNewResponse,
|
||||||
|
ModelsListParams,
|
||||||
ModelsListResponse,
|
ModelsListResponse,
|
||||||
ModelUpdateBody,
|
ModelUpdateBody,
|
||||||
OcrBody,
|
OcrBody,
|
||||||
|
|
@ -336,7 +337,7 @@ class ProxyClient:
|
||||||
lambda poll_timeout: self.transport.get(
|
lambda poll_timeout: self.transport.get(
|
||||||
"/v1/models",
|
"/v1/models",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
params=NoBody(),
|
params=ModelsListParams(),
|
||||||
response_type=ModelsListResponse,
|
response_type=ModelsListResponse,
|
||||||
timeout=poll_timeout,
|
timeout=poll_timeout,
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -597,9 +597,20 @@ class TestSemanticAutoRouterResponses:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
assert answer.id, "/v1/responses through the semantic auto-router returned no response id"
|
assert answer.id, "/v1/responses through the semantic auto-router returned no response id"
|
||||||
rows: Final = proxy.poll_logs_for_key(key, min_rows=1)
|
rows: Final = proxy.poll_logs_for_key(
|
||||||
|
key,
|
||||||
|
min_rows=2,
|
||||||
|
predicate=lambda logged: any(row.model == EMBEDDING_MODEL for row in logged),
|
||||||
|
)
|
||||||
|
embedding_rows: Final = tuple(row for row in rows if row.model == EMBEDDING_MODEL)
|
||||||
|
assert embedding_rows, (
|
||||||
|
"the routing embedding was not billed to the caller's key; "
|
||||||
|
f"spend logs show {tuple(row.model for row in rows)}"
|
||||||
|
)
|
||||||
_assert_served_only_by(
|
_assert_served_only_by(
|
||||||
rows, CHEAP_SERVED | {semantic_auto_router.target}, "semantic auto-router /v1/responses string input"
|
[row for row in rows if row.model != EMBEDDING_MODEL],
|
||||||
|
CHEAP_SERVED | {semantic_auto_router.target},
|
||||||
|
"semantic auto-router /v1/responses string input",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue