Repository navigation
chat : refactor API - #30210
Merged
Merged
chat : refactor API#30210
Conversation
…internal chat fields
pwilkin
approved these changes
Oct 9, 2026
pwilkin
left a comment
Member
There was a problem hiding this comment.
Looking good :) gonna run the bot review just in case.
Member
|
/bot review |
|
❌ Code review failed. |
Contributor
|
Nice refactor, I tested it in my Debian container with Qwen3 30B A3B Thinking (autoparser) and Gemma 4 E4B (dedicated handler) across plain, tools, streaming, n=2, continuation with and without echo, and everything behaves as expected. The CI failures are unrelated to this PR. A few leftovers from the old JSON path are now dead code. Outputs are byte identical with them removed, here is the patch: |
ServeurpersoCom
approved these changes
Oct 9, 2026
Contributor
Author
|
@ServeurpersoCom good catch, thank you. |
ggerganov
approved these changes
Oct 9, 2026
ggerganov
left a comment
Member
There was a problem hiding this comment.
The common/sampling changes are OK.
ngxson
approved these changes
Oct 9, 2026
feal87
added a commit
to feal87/myllama.cpp
that referenced
this pull request
Oct 9, 2026
Upstream brings the chat API refactor into common_chat_session (PR ggml-org#30210), the UI models manager (ggml-org#29583), server default port 9931 (ggml-org#30159), and CUDA / metal / sycl / vulkan / musa fixes. Conflicts and resolution: - server-context.cpp: upstream moved message spans into task.apply_chat_session() and dropped the per-request message_delimiters JSON round-trip. Keep the fork deferred-mtmd loop bound (n_inputs) and pass chat_session.message_delimiters() to task.mtmd_delims. - server-queue.cpp: keep the fork reported_tool_names / base_tool_names / markdown_fences bookkeeping and adapt it to upstream's task_result_state() free constructor. Kept the fork MoE expert cache (src/llama-moecache.*); scripts/fork-post-merge.sh reports no upstream MoE cache leftovers. Assisted-by: pi (deepseek-flash)
10 of 11 tasks
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.
Overview
Refactored the interaction between the server and chat components through a
common_chat_sessionobject:Moved various operations (chat template detection, autoparser analysis, tokenization) to
chat_common_templateconstruction so they only run once per template and not on every request.Removed the PEG parser's JSON serialization that was put in place to integrate with the existing code.
The underlying flow in
common/is still the same: init + parse, but this opens up the opportunity to refactor that in isolation.Requirements