[Docs] Streaming example diff logic for reasoning_details doesn't match actual API behavior
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 35/100
- Issue 類型
- 文件
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- python
研究方向
Open the linked OpenAI-compatible streaming example in the API documentation and inspect how it processes reasoning_details[].text and updates reasoning_buffer. Check whether the example's diff logic matches the reported incremental chunks; the documentation is done when it handles the reported behavior correctly and clarifies any difference between the two API endpoints if confirmed.
由索引模型根據 Issue 內容生成。
描述
Problem
In the OpenAI-compatible API streaming example, reasoning_details is processed with a diff approach:
reasoning_text = detail["text"]
new_reasoning = reasoning_text[len(reasoning_buffer):]
reasoning_buffer = reasoning_text
This assumes reasoning_details[].text is cumulative (full text so far), requiring a diff against the buffer to extract the new portion.
Actual Behavior
Testing against api.minimaxi.com/v1 with MiniMax-M2.7, reasoning_details[].text returns incremental text, not cumulative:
chunk1: text="The user"
chunk2: text=" is asking how I am, which is a simple greeting."
chunk2 does not contain chunk1's "The user" — it's already just the new part.
Bug
Applying diff logic to incremental text truncates the beginning of each chunk:
chunk1: buf="", text="The user", text[0:] = "The user" ✅ happens to work
chunk2: buf="The user"(len=8), text=" is asking...", text[8:] = "king..." ❌ truncated
Reproduction
from openai import OpenAI
client = OpenAI(
api_key="sk-xxx",
base_url="https://api.minimaxi.com/v1",
)
stream = client.chat.completions.create(
model="MiniMax-M2.7",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hi, how are you?"},
],
extra_body={"reasoning_split": True},
stream=True,
)
for chunk in stream:
if (
hasattr(chunk.choices[0].delta, "reasoning_details")
and chunk.choices[0].delta.reasoning_details
):
for detail in chunk.choices[0].delta.reasoning_details:
if "text" in detail:
text = detail["text"]
print(f"len={len(text)} text={repr(text)}")
Suggested Fix
If reasoning_details[].text is incremental, the example should simply concatenate:
for detail in chunk.choices[0].delta.reasoning_details:
if "text" in detail:
text = detail["text"]
print(text, end="", flush=True)
reasoning_buffer += text
Also, if api.minimax.io (international) and api.minimaxi.com (China mainland) behave differently for this field, it would be helpful to note that in the docs.
- 主要語言
- 沒有語言資料
- 星號
- 2.6k
- 分支
- 216
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MiniMax-AI/MiniMax-M2 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 1/100
MiniMax-AI/MiniMax-M2#133 ·
-
難度 1/5 1 小時以內 新手友好度 1/100
MiniMax-AI/MiniMax-M2#132 ·
-
難度 1/5 1 小時以內 新手友好度 1/100
MiniMax-AI/MiniMax-M2#130 ·
-
難度 1/5 1 小時以內 新手友好度 1/100
MiniMax-AI/MiniMax-M2#129 ·
-
難度 4/5 3-5 天 新手友好度 35/100
MiniMax-AI/MiniMax-M2#126 ·
查看 MiniMax-AI/MiniMax-M2 的全部 Issue
相似的 Issue
-
marketing
難度 2/5 1-3 小時 新手友好度 86/100
維護者通常 1 天內回覆
-
factory:subtask
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
documentation security
難度 2/5 1-3 小時 新手友好度 78/100
maiychrus25/OpenTea-DX-OS#221 ·
-
難度 2/5 1-3 小時 新手友好度 77/100
agent-substrate/substrate#4308 ·
維護者通常 2 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 82/100
TMHSDigital/Spackle#199 ·
維護者通常 1 天內回覆