mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4756] [Engine] chat completions: allow response_format with tools, as /v1/responses does #5163
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5163
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4756
Author: @Tsury
Created: 10/30/2026
Status: 🔄 Open
Base:
main← Head:fix-format-with-tools📝 Commits (1)
49c57f8[Engine] chat completions: allow response_format with tools, as /v1/responses does📊 Changes
2 files changed (+49 additions, -5 deletions)
View changed files
📝
serve/server.py(+16 -4)📝
serve/test_structured.py(+33 -1)📄 Description
Problem and result
/v1/chat/completionsanswers 400structured response_format with tools/MCP is not supportedwhen a request has both./v1/responsesaccepts the same pair: it callsprepare_format(..., with_tools=bool(tools)), and the format applies to the final answer.After this change, the chat route does the same. A turn that calls a tool passes through unchecked; a final answer must match the schema, or it fails with the existing error.
strata_mcpwith a format stays a 400.Related discussion
#2397 (@Xantier) and #763 (@cipgysmo) asked for this on older bases; #2397 closed in the 0.2.0-beta tracker reset. This uses the
with_toolspath that main now has.Approach
Pass
with_toolson the chat route.structured_chunksstops buffering at the firsttool_callsdelta, sends what it held, and streams the rest, as/v1/responsesdoes.Validation
Passed:
main(870aedd9): 4 failures and 1 error. With the change: all pass.python -m unittest serve.test_server serve.test_structured: 375 tests pass (Linux, Python 3.14).Not run:
python -m unittest discover -s serveand any GPU or model run. This change was split from a maintained v0.2.8 build that runs on an RTX 5090 Laptop; the unit tests above are the evidence for this branch.Limits
A turn that calls a tool is not validated, because it is not the final answer. Text sent before the call in that turn goes out unchecked.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.