litellm/tests/local_testing/test_model_alias_map.py
yuneng-jiang bcead282e2
test: move the remaining live groq call sites off the retired llama models (#37426)
The earlier sweep only caught the conformance suite in tests/llm_translation.
Groq retired llama-3.1-8b-instant alongside llama-3.3-70b-versatile, and four
tests under tests/local_testing still call them for real, so litellm_router_testing
and both local_testing shards 404 with model_not_found.

Only the sites that leave the process move. The chunk fixtures in
test_stream_chunk_builder, and the cost and routing tests that never open a
socket, keep the old ids because the string is data there, not a request.
2026-08-18 20:26:17 -07:00

44 lines
1.2 KiB
Python

#### What this tests ####
# This tests the model alias mapping - if user passes in an alias, and has set an alias, set it to the actual value
import os
import sys
import traceback
sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import pytest
import litellm
from litellm import completion, embedding
litellm.set_verbose = True
model_alias_map = {"good-model": "groq/openai/gpt-oss-120b"}
def test_model_alias_map(caplog):
try:
litellm.model_alias_map = model_alias_map
response = completion(
"good-model",
messages=[{"role": "user", "content": "Hey, how's it going?"}],
top_p=0.1,
temperature=0.01,
max_tokens=10,
)
print(response.model)
for rec in caplog.records:
if rec.levelname == "ERROR" and rec.name.startswith("LiteLLM"):
pytest.fail(f"Unexpected litellm ERROR log: {rec.getMessage()}")
assert "gpt-oss-120b" in response.model
except litellm.ServiceUnavailableError:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
# test_model_alias_map()