[Docs] Streaming example diff logic for reasoning_details doesn't match actual API behavior
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Dokumentation
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- python
- Bereich
- documentation
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 2.6k
- Forks
- 216
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus MiniMax-AI/MiniMax-M2
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 1/100
MiniMax-AI/MiniMax-M2#133 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 1/100
MiniMax-AI/MiniMax-M2#132 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 1/100
MiniMax-AI/MiniMax-M2#130 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 1/100
MiniMax-AI/MiniMax-M2#129 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
MiniMax-AI/MiniMax-M2#126 ·
Alle Issues in MiniMax-AI/MiniMax-M2
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
-
documentation good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
qoretechnologies/qore#8336 ·
Maintainer antworten meist innerhalb von 1 Tag
-
docs
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag