Run failed: 2 validation errors for KnowledgeRetrievalNodeData
Self Checks
- [X] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [X] I have searched for existing issues search for existing issues, including closed ones.
- [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [X] Please do not modify this template :) and fill in all the required fields.
Dify version
0.7.3
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- Build a knowledge with a PDF document
- Choose the default "Knowledge Retrieval + Chatbot" from "Explore", choose the knowledge.
- Preview the "Knowledge Retrieval" Step with any keyword
- UI shows following error:
Run failed: 2 validation errors for KnowledgeRetrievalNodeData multiple_retrieval_config.weights.vector_setting.embedding_provider_name Field required [type=missing, input_value={'vector_weight': 1}, input_type=dict] For further information visit https://errors.pydantic.dev/2.8/v/missing multiple_retrieval_config.weights.vector_setting.embedding_model_name Field required [type=missing, input_value={'vector_weight': 1}, input_type=dict] For further information visit https://errors.pydantic.dev/2.8/v/missing
✔️ Expected Behavior
No response
❌ Actual Behavior
No response
@lin1shu Hello there! I'm here to help you with any bugs, questions, or contributions while you're waiting for a human maintainer.
I found a similar issue that might help resolve your problem. The issue titled "Error in using knowledge base recall test" was closed and suggested ensuring that the handleChange function correctly updates the multiple_retrieval_config without including any extra inputs [1].
To resolve the validation errors for KnowledgeRetrievalNodeData in Dify version 0.7.3, ensure that the following fields are correctly populated:
- Selecting the Query Variable: Ensure that the
query_variable_selectoris set to the appropriate user input variable, typically "sys.query" in conversational applications. - Choosing the Knowledge Base for Query: Ensure that
dataset_idsis populated with the IDs of the knowledge bases you want to query. - Configuring the Retrieval Strategy:
- If
retrieval_modeismultiWayandmultiple_retrieval_config.reranking_enableis true, ensure thatmultiple_retrieval_config.reranking_model.provideris set. - If
retrieval_modeisoneWay, ensure thatsingle_retrieval_config.model.provideris set.
- If
Here is a code snippet that shows how to set these fields correctly:
const knowledgeRetrievalNodeData = {
query_variable_selector: ['sys.query'], // Typically the user input variable
dataset_ids: ['your_dataset_id'], // IDs of the knowledge bases
retrieval_mode: RETRIEVE_TYPE.multiWay, // or RETRIEVE_TYPE.oneWay
multiple_retrieval_config: {
top_k: DATASET_DEFAULT.top_k,
score_threshold: undefined,
reranking_enable: true, // or false
reranking_model: {
provider: 'your_reranking_model_provider', // Required if reranking_enable is true
},
weights: {
vector_setting: {
vector_weight: 1,
embedding_provider_name: 'your_embedding_provider_name', // Required field
embedding_model_name: 'your_embedding_model_name', // Required field
},
keyword_setting: {
keyword_weight: 1,
},
},
},
single_retrieval_config: {
model: {
provider: 'your_model_provider', // Required if retrieval_mode is oneWay
},
},
};
Ensure that you replace 'your_dataset_id', 'your_reranking_model_provider', 'your_embedding_provider_name', and 'your_embedding_model_name' with the actual values you are using. Additionally, make sure that the datasets you are querying have completed indexing and are enabled [2][3][4].
To continue talking to Dosu, mention @dosu.
Can you paste your configurations here?
Thanks @crazywoola . Please see the screenshot below. Also, I tried the same settings as you posted and still got the same error message.
I have the same problem.
I have the same problem.
I delete the Knowledge Retrieval node and create a new one, it works for me. Hope it will help you!
If I delete and recreate the knowledge node created from the Knowledge Retreival + Chatbot template, the error no longer occurs.
I'm trying to build a simple chatbot but having the same issue. Here is the error I'm getting
Run failed: 2 validation errors for KnowledgeRetrievalNodeData multiple_retrieval_config.reranking_model.provider Field required [type=missing, input_value={'reranking_provider_name...ranking_model_name': ''}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/missing multiple_retrieval_config.reranking_model.model Field required [type=missing, input_value={'reranking_provider_name...ranking_model_name': ''}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/missing
I've tried the deleting and recreating knowledge node suggested above but only got it to work in Preview and not when I go to Run App.
Tried everything but couldn't get it to work. Can anyone give me some pointers? Thank you!