Skip to content

fix(vlm): preserve explicit Ollama chat routes - #4898

Merged
qin-ctx merged 1 commit into
volcengine:mainfrom
r266-tech:codex/openviking-6133b28d2ee4
Sep 15, 2026
Merged

qin-ctx merged 1 commit into
volcengine:mainfrom
r266-tech:codex/openviking-6133b28d2ee4

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Description

An explicit ollama_chat/qwen2.5:7b model currently becomes ollama/ollama_chat/qwen2.5:7b before reaching LiteLLM. Preserve the configured local route through the existing prefix handling, so users can select Ollama's chat backend.

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

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

  • Bug fix (non-breaking change that fixes an issue)
  • Test update

Changes Made

Reuse OLLAMA_LITELLM_PREFIXES when 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

  • I have added tests that prove my fix is effective
  • New and existing focused unit tests pass locally
  • Tested on macOS

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_chat cases fail and the other 27 provider-detection cases pass. The fixed tests cover keyed/keyless construction, explicit/default API base, both completion entrypoints, ordinary ollama/ and openai/ routes, tool definitions, and default/custom num_ctx and think options.

Ruff check/format and git diff --check pass. No live Ollama inference or full repository suite was run; outbound dispatch is the tested boundary. Existing Pydantic deprecation warnings remain.

python -m mypy on 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 unchanged parser_config.py; the provider file has the same pre-existing content annotation finding. No new diagnostic is on a changed line.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of the complete diff
  • Existing route options and other provider regressions are covered

Additional Notes

No configuration migration or default-provider change is required.

@qin-ctx
qin-ctx merged commit 9c921cc into volcengine:main Sep 15, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants