mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-12-06 00:03:11 +00:00
* fix(relayconvert): drop unnamed function calls from Responses output
A Chat Completions tool call without a function name cannot become a
valid Responses function_call item, so the non-stream conversion now
skips it instead of emitting an item with an empty name.
* fix(relayconvert): hold streamed tool calls until a name arrives
A streamed tool call is no longer announced while it has no function
name, whether or not custom tools are in play. A call whose name never
arrives is left out of the stream and the completed response. A call
ID that arrives after the first fragment becomes the item ID as long
as the item has not been announced yet.
* test(relayconvert): fold unnamed stream tool cases into the hold test
The two standalone stream tests repeated what the nameless-tool hold
test already covers. Their distinct checks now live in its subtests:
a held function call without custom tools, its late call ID becoming
the item ID, and calls whose name never arrives leaving no event,
output index or sequence number behind, with and without custom tools.
* fix(relayconvert): keep Responses custom tools on Claude and Gemini upstreams
Responses requests sent to Claude Messages dropped Codex custom tools
such as exec and apply_patch as unsupported hosted tools, and Gemini
omitted their definitions and stripped custom_tool_call history before
conversion. A forced custom tool_choice was rejected on both targets,
and Claude parsed JSON-looking custom tool input from history.
Claude and Gemini now get the same treatment as Chat Completions: each
custom tool is sent as a function that takes one string input, with
the grammar kept in the description, and a forced custom tool_choice
becomes the matching named tool choice when that tool was sent. Gemini
declarations go through the usual parameter cleanup.
custom_tool_call history replays the raw input as {"input": ...} on
both targets, and its outputs pair with the call as tool results. The
custom tool selection is shared by all three targets and recorded for
each of them, so the existing Chat to Responses step restores
custom_tool_call items from Claude and Gemini responses as well.
* test(relayconvert): cover custom tool restore from Claude and Gemini responses
Claude and Gemini responses reach the Responses format through the
Chat to Responses step, but only the Chat source had a restore test.
The test is now table-driven over all three sources and checks the
non-stream output item and the exact streamed custom tool events.
* test(gemini): assert custom tools survive the Responses to Gemini adaptor path
---------
Co-authored-by: Kabuda <495696116@qq.com>