When an LLM connects to two knowledge bases simultaneously, the context only have one result? #30514
Replies: 1 comment
-
|
Hi @chenglinLiang! I'm Dosu and I’m helping the dify team. Dify can retrieve and merge results from multiple knowledge bases into the LLM context if you use the "multiple" retrieval strategy. In this mode, Dify queries all configured knowledge bases, merges the results (optionally reranking them), and concatenates the content into a single context string for the LLM. This allows the LLM to see and process multiple results at once, not just one result or one knowledge base. If your knowledge bases use different segmentation or indexing techniques, you must enable reranking to merge results properly—otherwise, you'll get an error. You can further customize how results are merged or formatted using a Code or Template node after retrieval, which is helpful if you want to mark sources or control the structure of the context passed to the LLM. Be mindful of the LLM's context window, as merging too many results can exceed its limit. If you only see one source in the UI, it's likely a configuration or display issue, not a backend limitation—Dify tracks all sources in the metadata. For more details, see this discussion and the retrieval implementation. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Self Checks
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Friends, I want to implement a knowledge base scoring workflow that allows an LLM to connect to two knowledge bases using different segmentation modes, and then have the LLM score the search results from the two knowledge bases. However, it seems that the LLM context can only select one search result. Is there any good way to do this?
2. Additional context or comments
No response
Beta Was this translation helpful? Give feedback.
All reactions