[Docs] Streaming example diff logic for reasoning_details doesn't match actual API behavior
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 2.6k
- Fork
- 216
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 MiniMax-AI/MiniMax-M2
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
MiniMax-AI/MiniMax-M2#133 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
MiniMax-AI/MiniMax-M2#132 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
MiniMax-AI/MiniMax-M2#130 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 1/100
MiniMax-AI/MiniMax-M2#129 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
MiniMax-AI/MiniMax-M2#126 ·
Tất cả issue của MiniMax-AI/MiniMax-M2
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
qoretechnologies/qore#8336 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
metacpan/metacpan-api#1538 ·
-
Document TAI vs. TDBĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dsavransky/EXOSIMS#496 ·
-
documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Broken linksĐang mở📚 documentation 🤖 automated issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100