mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 04:15:24 -04:00
[DOCS]: Error in API reference for "Retrieve Chunks from a Knowledge Base / Test Retrieval" #294
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @yangzq50 on GitHub (Dec 25, 2025).
Type of Documentation Change
Error/Typo fix
Documentation Page URL or Path
https://docs.dify.ai/api-reference/datasets/retrieve-chunks-from-a-knowledge-base-test-retrieval
Current Content
In the code block "Retrieve Chunks from a Knowledge Base / Test Retrieval", I see the following usage:
The "reranking_mode" part is probably wrong.
The error also exists in:
https://github.com/langgenius/dify-docs/blob/47b663d99e710b22905c1971e20fbf9b1f36bdc9/en/api-reference/openapi_knowledge.json#L1772-L1784
Suggested Changes
I see another doc for 3.0.x, which can be used to access cloud.dify.ai service:
https://github.com/langgenius/dify-docs/blob/47b663d99e710b22905c1971e20fbf9b1f36bdc9/versions/3-0-x/en/user-guide/knowledge-base/knowledge-and-documents-maintenance/maintain-dataset-via-api.mdx?plain=1#L578-L602
Reason for Change
According to Dify source code, "reranking_mode" value can choose from "reranking_model" and "weighted_score".
https://github.com/langgenius/dify/blob/d01f2f7436eaa636b5cf5bfaf66bb0dbcb880e4d/api/core/rag/rerank/rerank_type.py#L1-L6
Code of Conduct
@dosubot[bot] commented on GitHub (Dec 25, 2025):
Hi @yangzq50! I'm Dosu and I’m helping the dify-docs team.
You're right—the documentation for the "reranking_mode" parameter is incorrect. The API expects "reranking_mode" to be a string with valid values "reranking_model" or "weighted_score", not an object with "reranking_provider_name" and "reranking_model_name" fields. The correct structure is supported by the codebase, where "reranking_mode" is defined as an enum with those two string options, and the reranking model details (provider and model name) are passed separately in a "reranking_model" object if needed (see code, retrieval logic).
The current docs and schema (for example, in openapi_knowledge.json) incorrectly show "reranking_mode" as an object. The correct usage is also reflected in the 3.0.x user guide, where "reranking_mode" is a string or null, and "reranking_model" is a separate object.
This error could cause confusion or failed API calls for users following the current example. The documentation and schema should be updated so "reranking_mode" is a string ("reranking_model" or "weighted_score"), and the reranking model details are provided in a separate "reranking_model" object if needed.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other