OpenAI Chat Completions: tool rounds drop the model's reasoning
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 50/100
Hướng nghiên cứu
Start in the Chat Completions tool loop of OpenAILanguageModel, where the next request's assistant message is rebuilt from content and tool calls only. Check the reference fork commit (gtokman/AnyLanguageModel@daf184b) for the nonstreaming change, then decide whether to store reasoning as Transcript.Reasoning entries as PR #290 does for Anthropic. Done means that a DeepSeek or gateway tool round sends back reasoning_content, reasoning and reasoning_details unchanged, with a test that inspects the request body.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
OpenAILanguageModel's Chat Completions tool loop drops the model's reasoning between tool rounds. Thinking models return it alongside their tool calls, in reasoning_content (DeepSeek's API) or reasoning and reasoning_details (OpenRouter, Vercel AI Gateway). The next request in the same response rebuilds the assistant message from the content and tool calls only, so the reasoning that planned those calls is lost.
Why it matters
- DeepSeek requires it. Its thinking mode docs say
reasoning_contentmust be passed back on tool-call turns, and its API returns 400 when it isn't. Other clients have hit this: NousResearch/hermes-agent#17400, langchain-ai/langchain#39370, Kilo-Org/kilocode#9501. - Through a gateway it fails silently. The Vercel AI Gateway accepts the requests, so nothing errors. But each round, the model sees its earlier tool calls without the reasoning behind them.
Reproduction
Run a session with tools against deepseek/deepseek-v4.1-flash-fast or zai/glm-5.3-fast on the Vercel AI Gateway (https://ai-gateway.vercel.sh/v1), and record the request bodies. Each response's choices[0].message has reasoning and reasoning_details next to tool_calls. In the next request, the matching assistant message has only content and tool_calls. Across one 8-round response, 0 of the 8 assistant messages carried the reasoning back.
PR #290 added reasoning transcript entries and replay for Anthropic. Chat Completions doesn't read or send these fields yet (checked on main at 80d50b0).
A possible fix
In the tool loop, decode the three fields from the response message and send them back unchanged on that round's assistant message. Keeping them within the one response matches DeepSeek's rule, so the transcript doesn't need to change. I did this for the nonstreaming loop in a fork, with a test: gtokman/AnyLanguageModel@daf184b. The commit is on 0.16.0. The streaming loop would need the same change, gathering the reasoning deltas.
A fuller version would store the reasoning as Transcript.Reasoning entries, as #290 does for Anthropic, so it could also be replayed after a transcript is restored. I'm happy to open a PR for either approach.
- Ngôn ngữ chính
- Swift
- Star
- 948
- Fork
- 99
- Merge trung bình
- 19 giờ 50 phút
- Pull request đã merge (30 ngày)
- 51
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của huggingface/AnyLanguageModel
-
OpenAILanguageModel replays tool-call arguments as GeneratedContent's Codable form, not JSONCó thể đã có người làm @gtokman đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
huggingface/AnyLanguageModel#324 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
huggingface/AnyLanguageModel#328 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
huggingface/AnyLanguageModel#327 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support the Gemini Interactions API in GeminiLanguageModelCó thể làm lại được @rizwankce đã nhận 8 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
huggingface/AnyLanguageModel#302 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
huggingface/AnyLanguageModel#291 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của huggingface/AnyLanguageModel
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] File transcription skips audio chunks shorter than one secondCó thể đã có người làm @sabbah13 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
altic-dev/FluidVoice#1161 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
swift.md: `Date(myString, strategy: .iso8601)` example omits `try` — the initializer is throwingĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
-
core: RAC_LLM_OPTIONS_DEFAULT.min_p disagrees with the IDL's annotated defaultCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug core p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
RunanywhereAI/runanywhere-sdks#1083 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
bug/fix needs: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
capawesome-team/capacitor-firebase#1054 ·
Maintainer thường phản hồi trong vòng 1 ngày