Skip to content

test(together_ai): move request-shape checks to the mapped file, drop the live ones - #41360

Merged
yuneng-berri merged 8 commits into
mainfrom
litellm_unpin_together_ai_serverless_model
Sep 16, 2026
Merged

yuneng-berri merged 8 commits into
mainfrom
litellm_unpin_together_ai_serverless_model

Conversation

@yuneng-berri

@yuneng-berri yuneng-berri commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • Three tests pinned a Together model that left serverless
  • The live API now answers 400 model_not_available

How it solves it:

  • Delete all three: e2e already covers the live behavior
  • Assert the two request shapes in the mapped transformation file

User Flow

This is a test-only change. No runtime behavior changes, so there is no end user flow to describe

Relevant issues

Affected release

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • The handful of test files covering my change pass locally
  • My PR passes all required CI/CD checks
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

This PR only touches test files, so there is nothing to exercise against a live proxy: runtime behavior is identical before and after. The failure was the live vendor call itself, so the proof is the red run, plus a mutation check that the replacement assertions actually bite

Before (c64b821)

the three tests fail against Together

  1. uv run pytest tests/local_testing/test_completion.py::test_completion_custom_provider_model_name tests/local_testing/test_completion.py::test_customprompt_together_ai tests/local_testing/test_completion.py::test_completion_together_ai_stream -q
  2. Output:
E  litellm.BadRequestError: Together_aiException - {
E    "error": {
E      "message": "Unable to access non-serverless model openai/gpt-oss-20b. Please visit
E                  https://api.together.ai/models/openai/gpt-oss-20b to create and start a
E                  new dedicated endpoint for the model.",
E      "type": "invalid_request_error",
E      "code": "model_not_available"
E    }
E  }
3 failed

After (8c046e1)

the three are gone and the file still collects

  1. uv run pytest tests/local_testing/test_completion.py --collect-only -q
  2. Output:
127 tests collected in 0.08s

the mapped file carries the two request-shape assertions

  1. uv run pytest tests/test_litellm/llms/together_ai/chat/test_together_ai_chat_transformation.py -q
  2. Output:
85 passed, 2 warnings in 1.34s

the new prefix assertion catches an over-strip

  1. Temporarily change "model": model, to "model": model.split("/")[-1], in litellm/llms/openai/chat/gpt_transformation.py
  2. uv run pytest tests/test_litellm/llms/together_ai/chat/test_together_ai_chat_transformation.py -q
  3. Output:
FAILED ...::test_completion_routes_through_together_chat_config
FAILED ...::test_only_the_provider_prefix_is_stripped_from_a_slashed_model_name
2 failed, 83 passed
  1. Revert the edit

Type

✅ Test

Caveats (if any)

Medium

  • test_custom_role_wrappers_never_reach_the_request pins roles being ignored
    • Together goes through the OpenAI compatible path, so the wrappers never reach the request
    • The kwarg is dropped with no error, which someone may want to change
    • Pinning it means a deliberate change gets noticed instead of passing silently

Low

  • Streaming now rides on e2e only
    • tests/e2e/llm_translation/test_together_ai_e2e.py covers it three ways against the live API
    • That file selects its model from the cost map, so it cannot rot the way the deleted tests did
    • It runs on the e2e lane rather than per PR, so a Together streaming break surfaces there, not in the fast suite

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

…trol

Together moved openai/gpt-oss-20b off serverless, so three tests started
failing with a 400 model_not_available from the live API. None of them was
really testing Together: they cover provider-prefix parsing, prompt shaping
and streaming, all litellm side. Mock the transport and assert those, so the
tests answer to our code instead of a vendor catalog.
@yuneng-berri
yuneng-berri requested a review from a team September 16, 2026 02:52
@greptile-apps

greptile-apps Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This test-only PR removes three brittle Together AI live tests pinned to an unavailable model and moves request-shape coverage into the mocked transformation suite.

  • Adds cost-map-driven selection for remaining Together live tests.
  • Uses a typed, immutable model for validating relevant cost-map fields.
  • Verifies that provider prefixes and custom role wrappers are handled correctly without making network requests.

Confidence Score: 5/5

The PR appears safe to merge because the remaining live tests select eligible models dynamically and the moved request-shape assertions run through a mocked transport.

No new actionable issues remain, and all previous findings were resolved by deleting the affected helpers or replacing the coarse type with a concrete validated model.

Important Files Changed
Filename Overview
tests/_live_test_helpers.py Adds typed selection of the cheapest active Together chat model matching requested capabilities.
tests/llm_translation/test_together_ai.py Replaces a retired pinned model with capability-aware dynamic model selection.
tests/local_testing/test_completion.py Removes three brittle live Together tests whose request-shape behavior is covered by mocked tests or e2e coverage.
tests/local_testing/test_text_completion.py Replaces the retired Together model pin with cost-map-driven model selection.
tests/test_litellm/llms/together_ai/chat/test_together_ai_chat_transformation.py Adds mocked request-shape coverage using LiteLLM's existing HTTP handler and httpx MockTransport.

Reviews (3): Last reviewed commit: "refactor(test): validate cost-map entrie..." | Re-trigger Greptile

Comment thread tests/local_testing/test_completion.py Outdated
Comment thread tests/local_testing/test_completion.py Outdated
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

… the live ones

Together moved openai/gpt-oss-20b off serverless and three tests in
test_completion.py died on a live 400. None of them needed Together to be up:
streaming is already covered live by tests/e2e/llm_translation/test_together_ai_e2e.py,
which picks its model from the cost map instead of pinning one, and the other
two are request-shape questions. Delete all three and assert the two shapes in
the mapped transformation file: the provider prefix is stripped without eating
the rest of a slashed model name, and custom role wrappers never reach the
request.
@yuneng-berri yuneng-berri changed the title test(together_ai): stop depending on a serverless model we do not control test(together_ai): move request-shape checks to the mapped file, drop the live ones Sep 16, 2026
tests/e2e/llm_translation/test_together_ai_e2e.py registers its model with the
full registry key, so a slashed together_ai/<vendor>/<model> goes through the
prefix strip on every e2e run and an over-strip would fail against the real
API. The unit assertion was a second copy of that. The roles check stays, since
nothing in e2e exercises it.
`together_ai/openai/gpt-oss-20b` was hardcoded in two live tests and is no
longer served, so both failed on a vendor catalog change rather than on
anything litellm did.

Both call sites now resolve the cheapest non-deprecated together_ai chat
entry at runtime, filtered on the capabilities the tests actually exercise,
mirroring what tests/e2e/llm_translation/test_together_ai_e2e.py already
does. The selector lives in tests/_live_test_helpers.py so both lanes share
one implementation.
CI runs these lanes as `python -m pytest` from the repo root, so the root is
already on sys.path and `tests._live_test_helpers` imports without help. The
insert only tripped the TQ003 test-quality budget.
@yuneng-berri

Copy link
Copy Markdown
Contributor Author

@greptile

Comment thread tests/_live_test_helpers.py Outdated
The selector read raw cost-map dicts as `Mapping[str, Any]`. It now validates
each together_ai entry into a frozen Pydantic model and takes the two
capabilities as keyword booleans, so nothing in the helper is coarsely typed
or stringly addressed.
@yuneng-berri

Copy link
Copy Markdown
Contributor Author

@greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants