Skip to content

feat(openai-compat): honor tool_choice on /v1 passthrough - #99

Merged
cidrblock merged 1 commit into
mainfrom
feat/openai-compat-tool-choice
Aug 4, 2026
Merged

feat(openai-compat): honor tool_choice on /v1 passthrough#99
cidrblock merged 1 commit into
mainfrom
feat/openai-compat-tool-choice

Conversation

@Hrithik-Gavankar

@Hrithik-Gavankar Hrithik-Gavankar commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Map OpenAI tool_choice (auto / none / required / specific function) to AI SDK toolChoice when openai_compat tools mode is passthrough (DR-032 / DR-046)
  • Reject invalid tool_choice, required/specific-function without usable tools, and unknown function names with 400 invalid_request_error
  • Leave tool_choice ignored when tools mode is off (same secure default as tools)
  • Document behavior in CONFIGURATION.md and record DR-046 (renumbered: main already used DR-045 for VS Code webview UX)

Closes #77

Rebase note

Rebased onto main to resolve docs/decisions.md conflict (DR number collision). Tool_choice decision is now DR-046.

Test plan

  • Unit: mapOpenAIToolChoice / validateToolChoiceAgainstTools cover all shapes + invalid inputs
  • Integration: passthrough forwards none / required / specific function; off mode ignores tool_choice
  • Integration: invalid tool_choice, required without tools, and unknown function → 400
  • AI SDK wiring: streamText receives toolChoice when tools are present
  • Manual (optional): with openai_compat.tools: passthrough, call /v1/chat/completions from Open WebUI / curl with tool_choice: "none" and "required" and confirm model behavior

@cidrblock
cidrblock force-pushed the feat/openai-compat-tool-choice branch from 4fc1006 to 4c35824 Compare August 4, 2026 12:50
@cidrblock

Copy link
Copy Markdown
Collaborator

Rebased onto main to clear the merge conflict.

Conflict was a DR number collision in docs/decisions.md: main already shipped DR-045 (VS Code webview UX). This PR’s tool_choice decision is now DR-046 (code/docs comments updated accordingly).

Force-pushed: 4fc10064c35824. Local openai-compat tests: 79 passed.

@cidrblock
cidrblock merged commit 1e91131 into main Aug 4, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(openai-compat): honor OpenAI tool_choice on /v1 when tools passthrough is enabled

2 participants