Pull requests / #3395
#3395 [Other] preserve Chat Completions tool result order
open · @j-luwierski · 0 コメント · GitHub で見る
Server & APIAMD / HIPNVIDIA / CUDALinux
本文
## Problem and result When an OpenAI Chat Completions request contains multiple tool calls and the client returns their tool results in a different order, the serving layer drops the call IDs before rendering the prompt. The model then sees anonymous results in arrival order, even when the results belong to calls with the same function name. The fix restores the call order for complete, unambiguous result runs before removing the temporary IDs. ## Related discussion This follows the closed tracker-reset submission [#2952](https://github.com/Niko1221/Strata/pull/2952). The new branch is based on current main; the v0.2.0-beta tag is an ancestor of the base revision. ## Approach The Chat Completions conversion retains call IDs only while normalizing a request. It reorders a result run only when call and result IDs are nonempty unique strings with matching sets and counts. Missing, duplicate, unknown, or incomplete IDs keep their received order. IDs are removed before prompt rendering. No engine, template, Anthropic, Responses, or default behavior changes. ## Validation Environment: Linux, Python 3.12.14, dependencies from the repository's pinned requirements.txt. **Passed:** - Reproduction on unmodified main at 5bda973a4331212494d74cf35927ada7f0e063e7: /tmp/strata-pr2952-venv/bin/python -m unittest serve.test_chat_tool_results -q ran 7 tests and reproduced 4 failures, including reversed same-function results and the HTTP-to-engine prompt order. - Fixed revision 7b87be62201245a8747f248cd58b006c7ed9b92d: /tmp/strata-pr2952-venv/bin/python -m unittest serve.test_chat_tool_results serve.test_frontend serve.test_server serve.test_responses -q ran 415 tests; **OK (skipped=1)** in 128.991 seconds. - git diff --cached --check passed before commit. **Failed:** - None on the fixed revision. **Not run:** - GPU/model inference and CUDA, HIP, SYCL, or Metal builds. This change touches only Python serving code and its tests. ## Limits Only complete, unambiguous tool-result runs are reordered. Incomplete or ambiguous histories preserve their incoming order.
関連リンク
インストール・モデル・リリースへのサイト内リンク。