Skip to content

test(litellm): align Ollama context assertions with forwarded kwargs - #7312

Closed
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:codex/ollama-context-test-contract
Closed

r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:codex/ollama-context-test-contract

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

Description

Sixteen existing Ollama routing cases fail on current main because they expect num_ctx inside extra_body. The backend deliberately forwards it as a top-level LiteLLM argument, which LiteLLM serializes into Ollama's options.num_ctx; the existing test_ollama_num_ctx_lands_in_ollama_options_on_the_wire already verifies that contract.

Update the two routing expectations to check the forwarded context value separately from extra_body.think. This preserves coverage of default 16384, explicit 32768, and the thinking override while restoring the routing matrix.

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

The same pre-existing failures are recorded in #7311.

Type of Change

  • Test update

Changes Made

  • Replace the stale combined-body assertion with separate num_ctx and think expectations.
  • Update only the existing test; production code and test-case count are unchanged.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Python 3.14.10, current uv.lock, LiteLLM 1.102.4:

python -m pytest --noconftest -o addopts= tests/unit/test_extra_headers_vlm.py tests/unit/test_litellm_vlm_provider_detection.py tests/unit/test_vlm_thinking_param.py tests/unit/test_retry_vlm.py tests/unit/test_vlm_failover.py -q
python -m ruff check tests/unit/test_litellm_vlm_provider_detection.py
python -m ruff format --check tests/unit/test_litellm_vlm_provider_detection.py
python -m mypy --follow-imports=skip tests/unit/test_litellm_vlm_provider_detection.py
git diff --check

174 tests pass, including the routing matrix and existing Ollama serialization contract. Before this change, the routing module alone has 16 failures and 19 passes on unmodified main@36354fa6e. Ruff, format, isolated mypy, and diff checks pass. The focused runner excludes unrelated service/native fixtures; existing dependency/deprecation warnings remain. No Ollama server or live model/provider was used.

Checklist

  • My code follows the project's coding style
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

@r266-tech

Copy link
Copy Markdown
Contributor Author

#7903 and #8034 independently reported these same 16 failures on their unmodified baselines. I reran the five VLM test modules listed in the PR description on main@81c621031f with Python 3.14.10 and the current lock (LiteLLM 1.103.10).

Unmodified main passed 162 tests and failed 16, all in the Ollama extra_body assertion. The same suite passed all 178 tests after applying this PR's test-only patch (2b2f9e6620). That includes the existing test_ollama_num_ctx_lands_in_ollama_options_on_the_wire test, which checks LiteLLM's request serialization. Ruff, format, and isolated mypy checks passed. The run used local fixtures without an Ollama server or live model requests.

@r266-tech

Copy link
Copy Markdown
Contributor Author

我用 Python 3.14.10 和锁定的 LiteLLM 1.103.10 对照跑了 5 个 VLM 测试文件。main@f62a34de 有 16 个 Ollama 路由断言失败,应用这条 PR 的补丁后 178 项通过。#8095 的 65f03be 通过 159 项。它把 24 个路由用例收敛到 5 个,保留了两种 Ollama 路由的默认及显式 num_ctx、think 和同步、异步调用覆盖。两边现有的 LiteLLM 请求序列化测试也通过。

@qin-ctx,这两条 PR 覆盖了同一处断言修复。你倾向先走哪条?如果 #8095 先合入,我会在 main 上复验并关闭已被覆盖的 #7312。以上使用本地夹具完成,由 AI 辅助验证。

@r266-tech

Copy link
Copy Markdown
Contributor Author

主线已通过 #8261 覆盖本 PR 的 Ollama 断言。在 main@76fc174edb 上复验,默认和显式 num_ctx 都从顶层参数传给 LiteLLM,序列化测试也确认它进入请求的 options.num_ctx。路由和请求参数两个测试文件共 90 项通过,关闭这条重复 PR。AI 独立验证。

@r266-tech r266-tech closed this Nov 23, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Nov 23, 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.

1 participant