Skip to content

Managed batches - Address PR bot comments from #22464 - #22666

Merged
Sameerlite merged 1 commit into
BerriAI:mainfrom
Point72:ephrimstanley/batch-fixes-mar3
Mar 4, 2026
Merged

Managed batches - Address PR bot comments from #22464#22666
Sameerlite merged 1 commit into
BerriAI:mainfrom
Point72:ephrimstanley/batch-fixes-mar3

Conversation

@ephrimstanley

Copy link
Copy Markdown
Contributor

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • 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

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@vercel

vercel Bot commented Mar 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Error Error Mar 3, 2026 4:02pm

Request Review

@ephrimstanley

Copy link
Copy Markdown
Contributor Author

@greptile-apps

@greptile-apps

greptile-apps Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR addresses three review bot comments from #22464 for the managed batches / Vertex AI files feature:

  • file_retrieve Literal type fix: Adds "gemini" and "vertex_ai" to the custom_llm_provider Literal in the sync file_retrieve function, aligning it with the already-updated afile_retrieve. Without this, passing these providers would fail type-checking and fall through to a BadRequestError.
  • GCS delete URI reconstruction fix: Fixes transform_delete_file_response to include the bucket name in the reconstructed gs:// URI by extracting the bucket from the /b/ segment of the GCS URL, not just the object path from /o/.
  • Logging improvement: Removes an unnecessary hasattr guard on httpx.HTTPStatusError.response and switches from f-string to lazy %-formatting in the error logger for the async batch create path.

All changes are well-scoped to the Vertex AI provider directory (per custom rule on provider-specific code) and accompanied by mock-only regression tests.

Confidence Score: 5/5

  • This PR is safe to merge — it fixes three small, well-tested bugs with no behavioral regressions.
  • All three fixes are straightforward, well-scoped, and backed by mock-only regression tests. The Literal type fix aligns with the already-correct async counterpart, the GCS URI fix correctly reconstructs the full gs:// path, and the logging change is a clean improvement. No new dependencies, no architectural changes, no risk of regressions.
  • No files require special attention.

Important Files Changed

Filename Overview
litellm/files/main.py Added "gemini" and "vertex_ai" to the Literal type for custom_llm_provider in file_retrieve, aligning it with afile_retrieve. Correct fix.
litellm/llms/vertex_ai/batches/handler.py Removed unnecessary hasattr guard on httpx.HTTPStatusError (always has .response) and switched to lazy %-formatting for logger. Clean improvement.
litellm/llms/vertex_ai/files/transformation.py Fixed transform_delete_file_response to include the GCS bucket name in the reconstructed gs:// URI by also splitting on /b/. Bug fix with good guard clause.
tests/test_litellm/llms/vertex_ai/files/test_file_retrieve_provider_routing.py New mock-only test file for file_retrieve routing with vertex_ai and gemini providers. Tests are well-structured and use proper mocking.
tests/test_litellm/llms/vertex_ai/files/test_vertex_ai_files_transformation.py Updated existing test assertion and added two regression tests for the bucket-in-delete-id fix. All mock-only, no network calls.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["afile_retrieve(custom_llm_provider='vertex_ai')"] --> B["file_retrieve(custom_llm_provider='vertex_ai')"]
    B --> C{"Provider in OpenAI-compatible list?"}
    C -->|No| D{"Provider == 'azure'?"}
    D -->|No| E["ProviderConfigManager.get_provider_files_config()"]
    E --> F["base_llm_http_handler.retrieve_file()"]
    F --> G["GCS API call"]
    G --> H["Return OpenAIFileObject"]

    I["transform_delete_file_response()"] --> J{"URL contains /b/ and /o/?"}
    J -->|Yes| K["Extract bucket from /b/ segment"]
    K --> L["Extract object from /o/ segment"]
    L --> M["Reconstruct gs://bucket/object"]
    J -->|No| N["Fallback: id = 'deleted'"]
Loading

Last reviewed commit: b83373d

@Sameerlite
Sameerlite merged commit 1202010 into BerriAI:main Mar 4, 2026
3 of 36 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…es-mar3

Managed batches - Address PR bot comments from BerriAI#22464
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