-
Notifications
You must be signed in to change notification settings - Fork 0
[WRONG BRANCH] fix(responses): preserve forced hosted web_search choice #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,6 +161,20 @@ describe("Responses parser", () => { | |
| expect(parsed.options.toolChoice).toEqual({ allowedTools: ["web_search"], mode: "required" }); | ||
| }); | ||
|
|
||
| test("maps a forced hosted web_search choice to the synthetic routed tool", () => { | ||
| const parsed = parseRequest({ | ||
| model: "umans/umans-kimi-k2.7", | ||
| input: "search", | ||
| tools: [ | ||
| { type: "web_search" }, | ||
| { type: "function", name: "run_shell", parameters: { type: "object" } }, | ||
| ], | ||
| tool_choice: { type: "web_search" }, | ||
| }); | ||
|
|
||
| expect(parsed.options.toolChoice).toEqual({ name: "web_search" }); | ||
| }); | ||
|
Comment on lines
+164
to
+176
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Add coverage for The parser now handles both As per path instructions, behavior changes in 🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| test("maps type-only hosted image_generation tool_choice to required image_gen", () => { | ||
| const parsed = parseRequest({ | ||
| model: "claude-opus-4-6", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For a routed Responses request whose tool declaration and choice both use the supported
web_search_previewtype, this new branch setstoolChoiceto{ name: "web_search" }, butextractHostedWebSearch()recognizes onlytype === "web_search". Consequently_webSearchremains unset,planWebSearch()returns no plan, the synthetic tool is never injected, and adapter filtering removes every unrelated declared tool, so the model produces an ordinary answer without performing the forced search. Normalize or extractweb_search_previewas a hosted search too, and add a routed-planning regression case for this branch.AGENTS.md reference: src/AGENTS.md:L22-L25
Useful? React with 👍 / 👎.