test(e2e): cover 12 non-core LLM coverage registry cells - #34123
Conversation
… test EndpointsClient exposes the shared ProxyClient as .proxy and has never had a .gateway attribute, so these two calls raised AttributeError at runtime and failed the tests/e2e basedpyright zero-error gate for any PR touching e2e files. Introduced in 23b5b7d.
Raises Non-Core LLMs registry coverage from 24/50 to 36/50 (overall 51.9% to 54.8%). Four cells were already asserted by existing tests and only gain their covers marker (openai embeddings, openai image generation, openai TTS, cohere rerank); one is dual-marked onto the existing spend-tracking embeddings test rather than duplicated. New tests: bedrock and vertex embeddings, streaming TTS (asserts chunked transfer encoding so a buffered body cannot pass), audio transcriptions via the realtime suite's wav fixture, moderations flag/pass pair, and files list/retrieve in the batches suite. Harness: e2e_http.upload generalized to any form model with a file_content_type override (batches path unchanged), new stream_binary primitive + BinaryStream for binary chunked responses, transcribe and moderations client methods, file retrieve/list client methods.
Greptile SummaryThis PR expands live end-to-end coverage for non-core LLM features. The main changes are:
Confidence Score: 5/5This looks safe to merge.
|
| Filename | Overview |
|---|---|
| tests/e2e/e2e_http.py | Adds binary response streaming, bounded error details, and configurable multipart file content types. |
| tests/e2e/transport.py | Extends each transport implementation with binary streaming and generalized multipart uploads. |
| tests/e2e/llm_translation/endpoints_client.py | Adds typed client methods for streamed speech, transcription, and moderation. |
| tests/e2e/llm_translation/test_audio_speech_e2e.py | Adds streamed speech coverage and includes provider response details in failure output. |
| tests/e2e/llm_translation/test_audio_transcriptions_e2e.py | Adds a multipart transcription test using the existing spoken-weather fixture. |
| tests/e2e/llm_translation/test_moderations_e2e.py | Adds live moderation tests for violent and benign input. |
| tests/e2e/batches/test_batches_e2e.py | Adds OpenAI file list and metadata retrieval coverage. |
Reviews (2): Last reviewed commit: "fix(e2e): close streamed TTS response on..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…error body With stream=True a non-2xx response returned with the body unread, keeping the socket checked out until garbage collection; the sibling _streaming_outcome already consumes resp.text on error. The response now closes on every path and BinaryStream carries a bounded error_body so a failed stream call is triageable.
|
@greptileai re review |
…itellm_e2e_noncore_llm_cells
|
vertex_ai/gemini-embedding-2 are you sure this is a legit embedding? looks sus to me |
|
needs assert result.content_length is None for (no content-length) Expect status 200, an audio content-type, transfer-encoding: chunked on the response (no content-length), and non-zero audio bytes |
fixed |
e967bc8
into
litellm_internal_staging
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proof is pending: the environment this was authored in has no provider credentials, so the new tests have not yet been run against real providers. They will be run 5x with cooldowns against a live proxy (real OpenAI, Bedrock, and Vertex calls, real cost) and the command plus output posted here with the commit hash before requesting maintainer review. The run command is
Static validation already done at 9076968: full-suite collection is clean (338 tests),
python -m coverage_registry.collector --strictexits 0 with Non-Core LLMs at 36/50 (was 24/50) and overall registry coverage at 54.8% (was 51.9%), andmake lint-e2e-basedpyrightreports zero errorsWiring was additionally verified at 60d52a1 against a live proxy running this branch (worktree code, port 41230, shared dev DB). The transcription path ran fully live against a real provider: registering
groq/whisper-large-v3through /model/new and posting the wav fixture as multipart with a freshly generated virtual key returned{"text":" What is the weather in Paris?"}with HTTP 200, confirming the new multipart plumbing, the route, and the test's weather assertion against a real transcript. Every other new test was then run against that proxy and failed only at the provider credential boundary (OpenAI and Bedrock key errors, expired Vertex ADC, and the transcription route passing through the provider's 401), with no harness-level failures. The audio speech route also round-tripped to the real Groq API (their side reports playai-tts decommissioned), and the streamed error path surfaced status and body exactly as designedType
✅ Test
Changes
Covers 12 Non-Core LLM coverage-registry cells. Four cells were already asserted by existing tests that predate the registry and only gain their
@pytest.mark.coversmarker: openai embeddings, openai image generation, openai TTS, and cohere rerank (the registry rows already pointed theirsource:at these tests). A fifth,llm.embeddings.openai.basic.nonstream.cost_logged, is intentionally dual-marked onto the existingtest_embedding_writes_nonzero_spend_rowin the spend-tracking suite, which already asserts exactly that behavior, rather than duplicating itNew tests: bedrock (
amazon.titan-embed-text-v2:0) and vertex (gemini-embedding-2) embeddings; streaming TTS, which asserts chunked transfer encoding so a buffered body cannot pass as a stream; audio transcriptions, uploading the realtime suite's spoken-weather wav fixture as multipart; a moderations flag/pass pair (only the flagging test claims the cell); and files list plus retrieve in the batches suite, where list uses a raw provider upload becauseGET /v1/filesreturns the org's raw ids while retrieve uses a model-encoded upload because the route re-encodes the id it was called withHarness additions, all backward compatible:
e2e_http.uploadnow takes any form model and an optionalfile_content_type(the batches path is byte-for-byte unchanged), astream_binaryprimitive plusBinaryStreamresult for binary chunked responses threaded through theTransportprotocol,transcribeandmoderationsmethods onEndpointsClient, andretrieve_file/list_filesonBatchClientA separate first commit fixes
client.gatewaytoclient.proxyintest_messages_mid_conversation_system_native_providers_e2e.py. That attribute never existed onEndpointsClient, so the helper raised AttributeError at runtime and failed the tests/e2e basedpyright zero-error CI gate for any PR touching e2e files, including this oneFound while writing the transcription test and filed as LIT-4653 (not fixed here): the
/v1/audio/transcriptionsroute resolves its server-default model fromgeneral_settings.moderation_model, a copy-paste from the moderations routeStill uncovered in Non-Core LLMs (14 cells), deferred for credential availability: the four
azure_openaicells, cohere embeddings, together_ai rerank, black_forest_labs image generation, and the nvidia_riva/soniox P2 smoke cells.llm.embeddings.anthropic.basic.nonstream.workslooks unimplementable as written since Anthropic has no embeddings API; the registry README already lists it as a prune candidateQA runbook
Marker-only changes (no test-body change, behavior already reviewed when these tests landed):
test_embeddings_returns_vector,test_image_generation_returns_image,test_audio_speech_returns_audio,test_rerank_scores_top_n, and the added second marker ontest_embedding_writes_nonzero_spend_rowbedrock/amazon.titan-embed-text-v2:0,aws_region_name us-west-2(needs ambient AWS credentials with Titan model access)vertex_ai/gemini-embedding-2,vertex_project os.environ/VERTEXAI_PROJECT,vertex_location us-central1(needs Vertex ADC on the proxy host)openai/gpt-4o-mini-ttstransfer-encoding: chunkedon the response (no content-length), and non-zero audio bytesopenai/gpt-4o-mini-transcribefile=llm_translation/realtime/fixtures/weather_question_24k.wavandmodel=<the deployment>openai/omni-moderation-latestresults[0].flagged truewith at least one category trueresults[0].flagged falsepurpose batch, routed raw to the openai providerpurpose batch; delete the file afterpurpose batch, andfilename batch_input.jsonl; delete the file afterEnvironment prerequisites for a manual run:
OPENAI_API_KEYin the proxy environment for every openai-route test, ambient AWS credentials with Bedrock Titan access for the bedrock test, Vertex ADC plusVERTEXAI_PROJECTfor the vertex test, andCOHERE_API_KEYonly if re-running the pre-existing rerank test. The files list test additionally needsfiles_settingswith an openai entry in the proxy config for the raw-provider/v1/filesroutes, the same prerequisite the suite's existing raw-upload tests already carryFinal Attestation