mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-07-22 04:15:24 -04:00
[DOCS]: API Documentation Error: Incorrect Description and cURL Example for the reranking_mode Parameter in the "Create an Empty Knowledge Base" Interface!
#297
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 @Guofu1149 on GitHub (Dec 30, 2025).
Type of Documentation Change
Error/Typo fix
Documentation Page URL or Path
https://docs.dify.ai/api-reference/datasets/create-an-empty-knowledge-base#body-retrieval-model-reranking-mode-one-of-0-reranking-provider-name
Current Content
Problem Description:
API Documentation Error: Incorrect Description and cURL Example for the
reranking_modeParameter in the "Create an Empty Knowledge Base" Interface!When using the
/v1/datasetsAPI to create an empty knowledge base, it was discovered that the description of theretrieval_model.reranking_modeparameter in the official documentation does not match the actual required format.Specific page URL: https://docs.dify.ai/api-reference/datasets/create-an-empty-knowledge-base#body-retrieval-model-reranking-mode-one-of-0-reranking-provider-name
Current Content
Official parameter Specific(wrong):
retrieval_model
object
Hide child attributes
retrieval_model.search_method
enum
The search method to use for retrieval.
Available options: hybrid_search,
semantic_search,
full_text_search,
keyword_search
retrieval_model.reranking_enable
boolean
Whether to enable a reranking model to improve search results.
retrieval_model.reranking_mode
object
Configuration for the reranking model.
Hide child attributes
retrieval_model.reranking_mode.reranking_provider_name
string
The provider of the rerank model.
retrieval_model.reranking_mode.reranking_model_name
string
The name of the rerank model.
retrieval_model.top_k
integer
The number of top matching results to return.
retrieval_model.score_threshold_enabled
boolean
Whether to apply a score threshold to filter results.
retrieval_model.score_threshold
number | null
The minimum score for a result to be included.
retrieval_model.weights
number | null
The weight of semantic search in a hybrid search mode.
retrieval_model.search_method
enum
The search method to use for retrieval.
Available options: hybrid_search,
semantic_search,
full_text_search,
keyword_search
retrieval_model.reranking_enable
boolean
Whether to enable a reranking model to improve search results.
retrieval_model.reranking_mode
object
Configuration for the reranking model.
Hide child attributes
retrieval_model.reranking_mode.reranking_provider_name
string
The provider of the rerank model.
retrieval_model.reranking_mode.reranking_model_name
string
The name of the rerank model.
retrieval_model.reranking_mode.reranking_provider_name
string
The provider of the rerank model.
retrieval_model.reranking_mode.reranking_model_name
string
The name of the rerank model.
official curl example(wrong):
curl --request POST
--url https://api.dify.ai/v1/datasets
--header 'Authorization: Bearer '
--header 'Content-Type: application/json'
--data '
{
"name": "",
"description": "",
"indexing_technique": "high_quality",
"permission": "only_me",
"provider": "vendor",
"external_knowledge_api_id": "",
"external_knowledge_id": "",
"embedding_model": "",
"embedding_model_provider": "",
"retrieval_model": {
"search_method": "hybrid_search",
"reranking_enable": true,
"reranking_mode": {
"reranking_provider_name": "",
"reranking_model_name": ""
},
"top_k": 123,
"score_threshold_enabled": true,
"score_threshold": 123,
"weights": 123
}
}
'
Reproduction Steps:
Send a request following the cURL example in the official documentation:
Receive a 400 error:
Actual Correct Configuration:
By creating a knowledge base via the web UI and examining the actual parameters, the correct configuration should be:
Problem Analysis:
reranking_modeas an object, but the actual API expects it to be a string (or null).reranking_modelfield, not the configuration placed withinreranking_mode.retrieval_model_dict, while it should beretrieval_modelin the request.Suggested Fixes:
reranking_modefrom "object" to "string | null".reranking_modelfield in the documentation:reranking_modeandreranking_model.Environment Information:
POST /v1/datasetsAdditional Information:
This issue prevents developers from successfully creating a knowledge base with rerank configuration as per the documentation, requiring additional debugging and reverse engineering to find the correct parameter format.
This issue clearly identifies the problem, provides a comparison between the error and the correct format, and offers specific suggestions for fixes, which will help the development team quickly locate and resolve the documentation error.
Suggested Changes
Suggested Fixes:
reranking_modefrom "object" to "string | null".reranking_modelfield in the documentation:Corrected Valid Request Body Example:
Actual Correct Configuration:
By creating a knowledge base via the web UI and examining the actual parameters, the correct configuration should be:
Problem Analysis:
reranking_modeas an object, but the actual API expects it to be a string (or null).reranking_modelfield, not the configuration placed withinreranking_mode.retrieval_model_dict, while it should beretrieval_modelin the request.Code of Conduct
@dosubot[bot] commented on GitHub (Dec 30, 2025):
You're correct: the API documentation currently describes
retrieval_model.reranking_modeas an object, but the backend expects it to be a string or null. The reranking configuration (provider and model name) should be placed in a separateretrieval_model.reranking_modelobject. Supplying an object forreranking_modecauses a 400 validation error, as the API only accepts a string or null for this field, and expects the reranking details inreranking_modelinstead. This is confirmed by the authoritative schema in the codebase and by user reports of the same issue.A correct example payload looks like this:
To fix the docs, update the type of
reranking_modeto "string | null", move the reranking provider/model fields into a separatereranking_modelobject, and clarify the distinction between these fields. The backend and UI both expect this structure, and the current docs are out of sync with the implementation and will cause validation errors if followed as written.See code reference
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@RiskeyL commented on GitHub (Jan 8, 2026):
Hi @Guofu1149, this has been fixed in #657. Thanks!