Repository navigation
fix(vlm): preserve explicit Ollama chat routes - #4898
Merged
Merged
Conversation
qin-ctx
approved these changes
Sep 15, 2026
3 of 4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
An explicit
ollama_chat/qwen2.5:7bmodel currently becomesollama/ollama_chat/qwen2.5:7bbefore reaching LiteLLM. Preserve the configured local route through the existing prefix handling, so users can select Ollama's chat backend.Human Involvement
Related Issue
Refs #4879; the reproduced routing defect and proposed boundary.
This addresses explicit route preservation. The report does not establish that this route caused every symptom; local-model DSL output quality and deployed tool delivery are outside this fix.
Type of Change
Changes Made
Reuse
OLLAMA_LITELLM_PREFIXESwhen recognizing complete model routes. Provider inference and request-option handling keep their existing behavior. Exercise the real constructor and synchronous/asynchronous completion entrypoints, replacing only the outbound LiteLLM calls with recording mocks.Testing
python -m pytest -o addopts="" tests/unit/test_litellm_vlm_provider_detection.py tests/unit/test_vlm_thinking_param.py tests/unit/test_litellm_vlm_gemini_cache.py tests/unit/test_extra_headers_vlm.py tests/unit/test_stream_config_vlm.py -q: 91 passed.On the original production source, the eight new
ollama_chatcases fail and the other 27 provider-detection cases pass. The fixed tests cover keyed/keyless construction, explicit/default API base, both completion entrypoints, ordinaryollama/andopenai/routes, tool definitions, and default/customnum_ctxandthinkoptions.Ruff check/format and
git diff --checkpass. No live Ollama inference or full repository suite was run; outbound dispatch is the tested boundary. Existing Pydantic deprecation warnings remain.python -m mypyon both changed paths is not clean on the baseline: it reports 1,531 existing errors across 209 imported modules. The patched run reports the same errors plus one missing PyYAML-stubs diagnostic in unchangedparser_config.py; the provider file has the same pre-existingcontentannotation finding. No new diagnostic is on a changed line.Checklist
Additional Notes
No configuration migration or default-provider change is required.