mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
test(integration): assert /v1/models reports max_input_tokens and max_output_tokens (#42858)
* test(integration): assert /v1/models reports max_input_tokens and max_output_tokens Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): pin published gpt-4o-mini limits instead of reading the cost map in-test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): name the gpt-4o-mini deployment explicitly in the /v1/models test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): cite the source of the pinned gpt-4o-mini limits Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: kerry <kerry@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
58e41e697b
commit
3b715525d3
1 changed files with 29 additions and 0 deletions
29
tests/integration/pricing/test_model_listing_token_limits.py
Normal file
29
tests/integration/pricing/test_model_listing_token_limits.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import uuid
|
||||
from typing import Final
|
||||
|
||||
from integration._support.client import Gateway, object_value
|
||||
from pydantic import JsonValue
|
||||
|
||||
|
||||
def _listed_model(gateway: Gateway, model: str) -> dict[str, JsonValue]:
|
||||
entries: Final = gateway.get("/v1/models")["data"]
|
||||
assert isinstance(entries, list)
|
||||
return next(object_value(entry) for entry in entries if object_value(entry)["id"] == model)
|
||||
|
||||
|
||||
def test_v1_models_carries_cost_map_context_window_for_a_known_model(gateway: Gateway) -> None:
|
||||
with gateway.scenario() as scenario:
|
||||
model: Final = scenario.model(model="openai/gpt-4o-mini")
|
||||
listed: Final = _listed_model(gateway, model)
|
||||
# OpenAI publishes these for gpt-4o-mini: https://platform.openai.com/docs/models/gpt-4o-mini (checked 2026-09-24)
|
||||
assert listed["max_input_tokens"] == 128000, listed
|
||||
assert listed["max_output_tokens"] == 16384, listed
|
||||
|
||||
|
||||
def test_v1_models_carries_deployment_model_info_limits_for_an_unknown_model(gateway: Gateway) -> None:
|
||||
unknown: Final = f"openai/custom-{uuid.uuid4().hex}"
|
||||
with gateway.scenario() as scenario:
|
||||
model: Final = scenario.model(model=unknown, model_info={"max_input_tokens": 4321, "max_output_tokens": 987})
|
||||
listed: Final = _listed_model(gateway, model)
|
||||
assert listed["max_input_tokens"] == 4321, listed
|
||||
assert listed["max_output_tokens"] == 987, listed
|
||||
Loading…
Add table
Reference in a new issue