Skip to content

Docs: update chat completions docs - #16100

Merged
yingfeng merged 1 commit into
infiniflow:mainfrom
buua436:b082
Jun 16, 2026
Merged

yingfeng merged 1 commit into
infiniflow:mainfrom
buua436:b082

Conversation

@buua436

@buua436 buua436 commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Syncs the /api/v1/chat/completions docs with the current behavior, including the new legacy streaming mode.

Type of change

  • Documentation Update

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The HTTP API reference for POST /api/v1/chat/completions is updated to document a new optional boolean legacy parameter. When legacy: true, streaming responses use v0.23.0-compatible format with cumulative answer values and no start_to_think/end_to_think fields. Streaming examples are replaced and expanded for both default and legacy modes.

Changes

legacy streaming parameter documentation

Layer / File(s) Summary
legacy parameter definition and behavior
docs/references/http_api_reference.md
Adds legacy as an optional boolean to the request parameter table and describes that legacy: true enables v0.23.0-compatible streaming with cumulative answer and omitted start_to_think/end_to_think fields.
Default and legacy streaming response examples
docs/references/http_api_reference.md
Replaces the prior non-legacy streaming response example with an updated version and adds a new legacy-mode example showing reasoning embedded in answer using <think> tags.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • infiniflow/ragflow#16014: Implements the actual legacy streaming behavior in chat_api.py that this PR documents, making it the direct code-level counterpart.

Suggested labels

🐞 bug, size:M

A rabbit hops through the docs with glee,
Adding legacy: true for all to see! 🐇
The <think> tags now nestle inside answer's stream,
Cumulative chunks flow like a carrot-fueled dream.
Old v0.23 friends rejoice — compatibility supreme! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Docs: update chat completions docs' is vague and generic. It uses non-descriptive language that doesn't convey the specific nature of the documentation update (adding legacy streaming parameter, updating examples, or format changes). Consider a more specific title like 'Docs: add legacy streaming mode parameter to chat completions API' or 'Docs: update chat completions endpoint with legacy format support' that better describes the key changes being made.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description addresses the required template sections with a clear problem statement and correctly marked type of change.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@buua436 buua436 added the ci Continue Integration label Jun 16, 2026
@buua436 buua436 changed the title fix: update chat completions docs Docs: update chat completions docs Jun 16, 2026
@buua436 buua436 removed the ci Continue Integration label Jun 16, 2026
@buua436
buua436 requested a review from writinwaters June 16, 2026 11:24

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/references/http_api_reference.md`:
- Around line 4313-4328: The response example in the documentation shows the
final flag set to false when it should be true. This chunk is emitted from
final_answer, so the final flag must be set to true to correctly document the
API contract and prevent streaming clients from misinterpreting when the
response is complete. Change the final field value from false to true in the
example response JSON.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 782d646a-449c-4002-bc47-24125f63da87

📥 Commits

Reviewing files that changed from the base of the PR and between 8067e97 and 6b375bd.

📒 Files selected for processing (1)
  • docs/references/http_api_reference.md

Comment on lines +4313 to +4328
"code": 0,
"message": "",
"data": {
"answer": "<think>The user just said \"hello\". I should respond warmly and ask how I can help. Let's keep it short and friendly.</think>Hello! 👋 Welcome!",
"reference": {
"chunks": []
},
"audio_binary": null,
"prompt": "",
"created_at": 1781250171.5262048,
"final": false,
"id": "76961783-1523-43f7-8148-19da08247922",
"session_id": "4edfabd6663211f1943e217dfc5f0165",
"chat_id": "d90fd732646f11f1803d2fb3c77f9b23"
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Mark the terminal legacy chunk as final.

This chunk is emitted from final_answer, so it should keep the upstream final flag. Showing final: false here documents the wrong contract and can mislead streaming clients about when the response is complete.

Suggested fix
-        "final": false,
+        "final": true,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"code": 0,
"message": "",
"data": {
"answer": "<think>The user just said \"hello\". I should respond warmly and ask how I can help. Let's keep it short and friendly.</think>Hello! 👋 Welcome!",
"reference": {
"chunks": []
},
"audio_binary": null,
"prompt": "",
"created_at": 1781250171.5262048,
"final": false,
"id": "76961783-1523-43f7-8148-19da08247922",
"session_id": "4edfabd6663211f1943e217dfc5f0165",
"chat_id": "d90fd732646f11f1803d2fb3c77f9b23"
}
}
"code": 0,
"message": "",
"data": {
"answer": "<think>The user just said \"hello\". I should respond warmly and ask how I can help. Let's keep it short and friendly.</think>Hello! 👋 Welcome!",
"reference": {
"chunks": []
},
"audio_binary": null,
"prompt": "",
"created_at": 1781250171.5262048,
"final": true,
"id": "76961783-1523-43f7-8148-19da08247922",
"session_id": "4edfabd6663211f1943e217dfc5f0165",
"chat_id": "d90fd732646f11f1803d2fb3c77f9b23"
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/references/http_api_reference.md` around lines 4313 - 4328, The response
example in the documentation shows the final flag set to false when it should be
true. This chunk is emitted from final_answer, so the final flag must be set to
true to correctly document the API contract and prevent streaming clients from
misinterpreting when the response is complete. Change the final field value from
false to true in the example response JSON.

@writinwaters writinwaters left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@yingfeng
yingfeng merged commit 1e4796d into infiniflow:main Jun 16, 2026
Harry-Hz-Zhang pushed a commit to Harry-Hz-Zhang/ragflow that referenced this pull request Jun 17, 2026
### What problem does this PR solve?
Syncs the /api/v1/chat/completions docs with the current behavior,
including the new legacy streaming mode.
### Type of change
- [x]  Documentation Update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants