Skip to content

fix(e2e): register batch + rust OCR deployments via /model/new - #32166

Merged
mubashir1osmani merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_batches_ocr_model_registration
Jul 5, 2026
Merged

mubashir1osmani merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_batches_ocr_model_registration

Conversation

@mubashir1osmani

Copy link
Copy Markdown
Contributor

Relevant issues

Follow-up to #32165

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Two pieces here. First, a fix: #32165 merged the batches conftest.py whose batch_deployments fixture registers deployments at runtime with client.create_model(provider.model, provider.litellm_params()), but the plumbing those calls need never landed, so on litellm_internal_staging today BatchClient has no create_model and Provider has no litellm_params. The fixture would AttributeError before any batch test ran

$ git show berri/litellm_internal_staging:tests/e2e/batches/capabilities.py | grep -c 'def litellm_params'
0

With this branch the batches suite (now including the bedrock cells) and the converted OCR suite collect cleanly

$ cd tests/e2e && python -m pytest --collect-only -q batches/ llm_translation/test_ocr_rust_e2e.py
...
llm_translation/test_ocr_rust_e2e.py::TestRustOcrGateway::test_rust_ocr_response[vertex-deepseek]
22 tests collected in 0.03s

These are live e2e tests; the assertions run in the e2e pipeline against the deployed gateway with real provider keys, and skip locally when no proxy answers the liveness probe

Type

🐛 Bug Fix

Changes

The batches change completes the runtime /model/new registration the merged fixture already assumes: BatchClient gets create_model / delete_model (mode=batch), Provider gets a per-provider litellm_params() for openai, azure, vertex_ai and bedrock, and the bedrock provider is enabled with its create + retrieve-only scenarios (scenarios_for_provider, no cancel or list upstream). COVERAGE.md is updated to match. This restores the batches suite that #32165 left non-runnable

The OCR change converts test_ocr_rust_e2e.py from reading the static gateway config (model_list / /model/info, a _ConfiguredModel read) to registering each provider's OCR deployment at runtime via /model/new and deleting it on teardown, so nothing is hardcoded into the gateway config and the suite matches the rest of tests/e2e/. Every case (mistral, azure_ai mistral, azure doc-intelligence, vertex mistral, vertex deepseek) now creates its own deployment, drives a real /v1/ocr call, and asserts a well-formed document

The batches conftest registers deployments at runtime with
client.create_model(provider.model, provider.litellm_params()), but
BatchClient had no create_model and Provider had no litellm_params, so the
batch_deployments fixture would AttributeError before any batch test ran.

Add create_model/delete_model on BatchClient, the per-provider
litellm_params() (openai/azure/vertex_ai/bedrock) on Provider, enable the
bedrock provider with its create+retrieve-only scenarios, and update
COVERAGE.md to match.
Convert the rust OCR suite from reading the gateway config (model_list /
/model/info) to registering each provider's deployment at runtime via
/model/new and deleting it on teardown, so nothing is hardcoded into the
gateway config and the suite matches the rest of tests/e2e/.
@mubashir1osmani
mubashir1osmani enabled auto-merge (squash) July 5, 2026 02:05
@greptile-apps

greptile-apps Bot commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR completes the runtime /model/new registration infrastructure that #32165 assumed but never landed: BatchClient gains create_model/delete_model, Provider gains litellm_params(), bedrock is enabled with its two supported scenarios, and test_ocr_rust_e2e.py is converted from static gateway-config discovery to per-test runtime registration.

  • Batch suite (batch_client.py, capabilities.py, conftest.py): BatchClient.create_model/delete_model are introduced to wire the session-scoped batch_deployments fixture; bedrock provider is uncommented and restricted to encoded/unified scenarios via scenarios_for_provider; raw_id_matches_provider for bedrock is tightened to arn:aws:bedrock:.
  • OCR suite (test_ocr_rust_e2e.py): Each provider is now a typed dataclass (MistralOcr, AzureAiOcr, AzureDocIntelligenceOcr, VertexOcr) implementing a litellm_params() protocol; tests register and teardown their own deployment instead of relying on static config; the config-file assertion test is removed.

Confidence Score: 3/5

The batch suite changes introduce a method delegation chain that calls a method that does not exist on the target object, meaning the batch deployment fixture will throw before any test body runs against a live proxy.

The OCR conversion is clean and wires correctly through EndpointsClient.create_model, which has a working implementation. The batch side has BatchClient.create_model and BatchClient.delete_model both forwarding to self.gateway.create_model/self.gateway.delete_model — methods absent from Gateway (a frozen-slots dataclass; e2e_gateway.py is untouched by this PR). The batch_deployments session fixture calls these unconditionally once the proxy answers its liveness probe, so the entire batch suite fails at fixture setup with AttributeError, reproducing the original breakage this PR aimed to fix.

tests/e2e/batches/batch_client.py — the new create_model/delete_model methods delegate to a missing Gateway method and need to be reimplemented directly against self.gateway.transport, following the pattern in tests/e2e/llm_translation/endpoints_client.py.

Important Files Changed

Filename Overview
tests/e2e/batches/batch_client.py Adds create_model/delete_model to BatchClient, but both delegate to self.gateway.create_model/self.gateway.delete_model which do not exist on Gateway — will AttributeError on every run with a live proxy.
tests/e2e/batches/capabilities.py Adds litellm_params() to Provider, enables bedrock, and restricts bedrock to encoded/unified scenarios; bedrock raw_model includes provider prefix unlike all other providers, which may cause JSONL validation failures upstream.
tests/e2e/llm_translation/test_ocr_rust_e2e.py Converts from static config-based model discovery to runtime /model/new registration per test; cleanup via resources.defer is correct; uses endpoints_client (which has a working create_model) rather than a missing gateway method.
tests/e2e/batches/COVERAGE.md Documentation updated to reflect runtime registration, bedrock enablement, and the addition of conftest.py to the file table; accurate.

Reviews (1): Last reviewed commit: "test(e2e): register rust OCR deployments..." | Re-trigger Greptile

Comment on lines +90 to +94
def create_model(self, model_name: str, litellm_params: LiteLLMParamsBody) -> str:
return self.gateway.create_model(model_name, litellm_params, mode="batch")

def delete_model(self, model_id: str) -> None:
self.gateway.delete_model(model_id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Gateway has no create_model or delete_model — both calls will AttributeError at runtime.

BatchClient.create_model delegates to self.gateway.create_model(model_name, litellm_params, mode="batch") and delete_model to self.gateway.delete_model(model_id), but neither method exists on Gateway (e2e_gateway.py is unchanged and defines no such methods; the class also uses slots=True, ruling out dynamic dispatch). The batch_deployments fixture in conftest.py calls these methods unconditionally whenever the proxy is live, so the entire batch suite will fail with AttributeError before any test body runs — the same breakage this PR set out to fix.

EndpointsClient.create_model shows the correct pattern: call self.gateway.transport.post("/model/new", ...) directly, passing ModelInfoBody(id=model_name, mode="batch") for the batch variant. The delete_model counterpart mirrors EndpointsClient.delete_model.

Comment on lines +104 to +110
Provider(
"bedrock",
"bedrock-batch",
"bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0",
can_cancel=False,
can_list=False,
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Bedrock raw_model includes the bedrock/ prefix, inconsistent with every other provider.

All other providers store just the bare model identifier in raw_model (e.g. "gpt-4o-mini", "gemini-2.5-flash"). The bedrock row stores "bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0", which jsonl_model will embed in the JSONL for the "encoded" scenario. If LiteLLM's Bedrock batch handler does not strip the bedrock/ prefix from JSONL request bodies before submission, Bedrock will reject the job. Consider using only the native model ID ("us.anthropic.claude-haiku-4-5-20251001-v1:0") in raw_model and keeping the provider prefix only in litellm_params.model, consistent with the other providers.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mubashir1osmani
mubashir1osmani merged commit ed07aec into litellm_internal_staging Jul 5, 2026
74 checks passed
@mubashir1osmani
mubashir1osmani deleted the litellm_e2e_batches_ocr_model_registration branch July 5, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants