server: support OpenAI tool calling (non-streaming, Qwen-style)#556
Open
KonstantinSKY wants to merge 1 commit into
Open
server: support OpenAI tool calling (non-streaming, Qwen-style)#556KonstantinSKY wants to merge 1 commit into
KonstantinSKY wants to merge 1 commit into
Conversation
43a878d to
2935bff
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2935bffe19
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Wire OpenAI tool calling through the local chat-completions server and the backend-uzu runtime: parse `tools` into a ToolNamespace and inject them into the prompt template; parse <tool_call> output into Output.tool_calls; emit tool_calls and finish_reason "tool_calls" in the response. Non-streaming only; streaming, the role:"tool" round-trip and tool_choice are follow-ups. Unsupported combinations are rejected with HTTP 400 instead of being silently mishandled: tools with stream:true, and tool_choice other than "auto".
2935bff to
5044de6
Compare
Contributor
|
Hi @KonstantinSKY! We appreciate your contribution. We’ll be migrating to the new message-processing mechanism with tool-call parsing by the end of next week, and after that we’ll be able to upstream your PR. |
Contributor
Author
|
Sure, sounds good — thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds OpenAI tool calling to the local chat-completions server (non-streaming) — first of a small series.
Why: OpenAI-compatible agentic clients need
toolsin the request andtool_callsin the response to drive a local uzu server; today the server silently ignores both.What:
chat_completions.rs): parsetools, build aToolNamespace, attach it to the conversation; emittool_callsandfinish_reason: "tool_calls"(content isnullwhen only tool calls are present).backend-uzu): feedtoolsinto the model's prompt template (the stock Qwen3 template already has the{% if tools %}branch) and parse the model's<tool_call>…</tool_call>output intoOutput.tool_calls.Scope / follow-ups: non-streaming only; output parsing targets the ChatML
<tool_call>format for now. Therole:"tool"round-trip, streaming deltas,tool_choice, and more model formats are separate PRs.Tested: unit tests for request→namespace,
<tool_call>parsing, and response serialization; verified end-to-end with a local model (Qwen3-0.6B) returning aget_weathertool call.