[Docs] Streaming example diff logic for reasoning_details doesn't match actual API behavior
まだ誰も着手していません。
評価
- 難易度
- 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 にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
qoretechnologies/qore#8336 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
metacpan/metacpan-api#1538 ·
-
Document TAI vs. TDBオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
dsavransky/EXOSIMS#496 ·
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Broken linksオープン📚 documentation 🤖 automated issue
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100