Skip to content

test(litellm): cover Responses named tool choice (#2953) - #2957

Merged
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
ijevin:fix/2953-litellm-responses-tool-choice
Jul 27, 2026
Merged

test(litellm): cover Responses named tool choice (#2953)#2957
nicoloboschi merged 1 commit into
vectorize-io:mainfrom
ijevin:fix/2953-litellm-responses-tool-choice

Conversation

@ijevin

@ijevin ijevin commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Problem

Hindsight sends named tool choices to LiteLLM using the Chat Completions shape:

{"type":"function","function":{"name":"recall"}}

Responses-compatible endpoints instead require the function name at the top level (#2953).

Root cause

Hindsight correctly passes the canonical Chat Completions shape to litellm.acompletion(). Since #2950, the API requires LiteLLM 1.93.0 or newer; that version already includes the upstream Responses bridge normalization from BerriAI/litellm#27634, which rewrites the named choice before sending it to /responses.

Adding a second serializer in Hindsight would duplicate upstream routing logic and risk the two implementations drifting.

Change

Add focused regression coverage for both wire formats:

  • A Responses-mode GitHub Copilot model reaches litellm.aresponses() with {"type":"function","name":"recall"}.
  • A Chat Completions model retains {"type":"function","function":{"name":"recall"}}.

The Responses test exercises Hindsight's real call_with_tools() -> litellm.acompletion() -> Responses bridge path, mocking only the downstream provider request.

Validation

uv run pytest -o addopts='' tests/test_litellm_tool_choice.py tests/test_codex_tool_choice.py -q
4 passed

uv run ruff check .
All checks passed!

uv run ruff format --check .
568 files already formatted

Closes #2953.

@nicoloboschi
nicoloboschi merged commit dcd3ba5 into vectorize-io:main Jul 27, 2026
88 checks passed
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.

LiteLLM provider sends incompatible named tool_choice to Copilot Responses

2 participants