Skip to content

fix: accept Azure assistant file ids#5759

Open
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/azure-assistant-file-id
Open

fix: accept Azure assistant file ids#5759
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/azure-assistant-file-id

Conversation

@he-yufeng
Copy link
Copy Markdown

Fixes #5664.

Summary

This updates the LiteLLM file-id path to treat Azure assistant-* ids the same way it already treats file-* ids for OpenAI/Azure providers.

Without this, an Azure-uploaded assistant file id can fall through the file URI fallback path instead of being sent as a Responses API file content block.

Verification

Ran locally on Windows:

python -m py_compile src\google\adk\models\lite_llm.py tests\unittests\models\test_litellm.py
uv run --extra dev pyink --check src\google\adk\models\lite_llm.py tests\unittests\models\test_litellm.py
uv run --no-sync python -m pytest tests\unittests\models\test_litellm.py -q -k "assistant_file_id or file_id_required_preserves_file_id" -o cache_dir=.tmp\pytest-cache
git diff --check

Result:

3 passed, 257 deselected

Note: uv run --extra test ... is currently blocked for me on Windows because the locked yarl==1.24.1 resolution has no Windows wheel. I installed the minimal target-test dependencies in the local venv and ran the focused test path above.

@he-yufeng he-yufeng force-pushed the fix/azure-assistant-file-id branch from 6c74218 to 90a0e69 Compare May 20, 2026 04:54
@adk-bot adk-bot added the models [Component] Issues related to model support label May 20, 2026
@rohityan rohityan self-assigned this May 20, 2026
@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label May 20, 2026
@rohityan
Copy link
Copy Markdown
Collaborator

Hi @he-yufeng , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@he-yufeng he-yufeng force-pushed the fix/azure-assistant-file-id branch from f21fc71 to c7eeaf3 Compare May 21, 2026 04:56
@he-yufeng
Copy link
Copy Markdown
Author

Rebased onto current upstream/main and re-ran the focused checks locally.

Validation:

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pytest tests\unittests\models\test_litellm.py -q --basetemp .tmp\pytest-5759
# 259 passed, 1 skipped

PYTHONUTF8=1 .\.venv\Scripts\python.exe -m pyink src\google\adk\models\lite_llm.py tests\unittests\models\test_litellm.py --check
PYTHONUTF8=1 .\.venv\Scripts\python.exe -m py_compile src\google\adk\models\lite_llm.py tests\unittests\models\test_litellm.py
git diff --check

The previous pre-commit failure looked like stale-main formatting churn; this branch is now a single commit on top of current main.

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

Labels

models [Component] Issues related to model support request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Title LiteLlm: Azure OpenAI file_id with assistant- prefix bypasses Responses-API content block

3 participants