mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
test(mistral): drop key-skip guards so web search tests replay under VCR
Every test in tests/llm_translation/ is auto-decorated with pytest.mark.vcr and replays from the Redis cassette cache without provider credentials; the MISTRAL_API_KEY skip guards opted these three tests out of that replay, so keyless CI runs got no regression signal from them. Removing the guards matches the rest of the folder (BaseLLMChatTest and recent provider tests carry no key guards) and turns the silent skip into either a cassette replay or a loud failure Also drop the manual LITELLM_LOCAL_MODEL_COST_MAP/model_cost reload and debug toggle (the folder conftest already pins the local cost map and reloads litellm per test) and assert supports_web_search directly so removing the capability flag from the pricing JSON fails the test instead of silently skipping it
This commit is contained in:
parent
30612b1d16
commit
ffc29e50a4
1 changed files with 2 additions and 19 deletions
|
|
@ -36,18 +36,8 @@ class TestMistralCompletion(BaseLLMChatTest):
|
|||
"""Web search is routed to the Conversations API for models that support it"""
|
||||
from litellm.utils import supports_web_search
|
||||
|
||||
if not os.getenv("MISTRAL_API_KEY"):
|
||||
pytest.skip("MISTRAL_API_KEY not set")
|
||||
|
||||
os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"
|
||||
litellm.model_cost = litellm.get_model_cost_map(url="")
|
||||
|
||||
litellm._turn_on_debug()
|
||||
|
||||
model = "mistral/mistral-medium-latest"
|
||||
|
||||
if not supports_web_search(model, None):
|
||||
pytest.skip("Model does not support web search")
|
||||
assert supports_web_search(model, None)
|
||||
|
||||
response = litellm.completion(
|
||||
model=model,
|
||||
|
|
@ -56,15 +46,12 @@ class TestMistralCompletion(BaseLLMChatTest):
|
|||
max_tokens=100,
|
||||
)
|
||||
|
||||
assert response is not None
|
||||
assert response.choices[0].message.content
|
||||
|
||||
def test_web_search_with_tool_call_history(self):
|
||||
"""The Conversations API accepts prior function-call history mapped to
|
||||
function.call / function.result input entries alongside a web search
|
||||
request (a 400 here means the mapped wire schema is wrong)."""
|
||||
if not os.getenv("MISTRAL_API_KEY"):
|
||||
pytest.skip("MISTRAL_API_KEY not set")
|
||||
|
||||
response = litellm.completion(
|
||||
model="mistral/mistral-medium-latest",
|
||||
messages=[
|
||||
|
|
@ -87,16 +74,12 @@ class TestMistralCompletion(BaseLLMChatTest):
|
|||
max_tokens=200,
|
||||
)
|
||||
|
||||
assert response is not None
|
||||
assert response.choices[0].message.content
|
||||
|
||||
def test_web_search_truncation_reports_length(self):
|
||||
"""The Conversations API returns no finish reason, so truncation is inferred
|
||||
from the token budget. Force a real truncation (max_tokens=1 with an
|
||||
overflowing prompt) and assert the response reports finish_reason='length'."""
|
||||
if not os.getenv("MISTRAL_API_KEY"):
|
||||
pytest.skip("MISTRAL_API_KEY not set")
|
||||
|
||||
response = litellm.completion(
|
||||
model="mistral/mistral-medium-latest",
|
||||
messages=[
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue