Connect External Knowledge
To make a distinction, knowledge bases independent of the Dify platform are collectively referred to as “external knowledge bases” in this article.
Functional Introduction
For developers with advanced content retrieval requirements, the built-in knowledge base functionality and text retrieval mechanisms of the Dify platform may have limitations, particularly in terms of customizing recall results.
Due to the requirement of higher accuracy of text retrieval and recall, as well as the need to manage internal materials, some developer teams choose to independently develop RAG algorithms and independently maintain text retrieval systems, or uniformly host content to cloud vendors’ knowledge base services (such as AWS Bedrock).
As a neutral platform for LLM application development, Dify is committed to providing developers with a wider range of options.
The Connect to External Knowledge Base feature enables integration between the Dify platform and external knowledge bases. Through API services, AI applications can access a broader range of information sources. This capability offers two key advantages:
- The Dify platform can directly obtain the text content hosted in the cloud service provider’s knowledge base, so that developers do not need to repeatedly move the content to the knowledge base in Dify;
- The Dify platform can directly obtain the text content processed by algorithms in the self-built knowledge base. Developers only need to focus on the information retrieval mechanism of the self-built knowledge base and continuously optimize and improve the accuracy of information retrieval.
Principle of external knowledge base connection
Connection Examples
AWS Bedrock
How to connect with AWS Bedrock Knowledge Base
LlamaCloud
Dify provides an official LlamaCloud plugin that helps you quickly connect to LlamaCloud knowledge bases.
Plugin Installation
- Visit the Dify Marketplace and search for
LlamaCloud
- Install and configure the LlamaCloud plugin according to the instructions
- Enable the plugin in the Dify platform
- Fill in the LlamaCloud API key and other necessary information following the plugin configuration wizard
- After configuration is complete, you can see the connected external knowledge base in your knowledge base list
With the LlamaCloud plugin, you can directly use LlamaCloud’s powerful retrieval capabilities in the Dify platform without writing custom APIs.
For more information about how it works, please refer to the plugin’s GitHub repository.
Video Tutorial
The following video demonstrates in detail how to use the LlamaCloud plugin to connect to external knowledge bases:
FAQ
How to Fix the Errors Occurring When Connecting to External Knowledge API?
Solutions corresponding to each error code in the return information:
Error Code | Result | Solutions |
---|---|---|
1001 | Invalid Authorization header format | Please check the Authorization header format of the request |
1002 | Authorization failed | Please check whether the API Key you entered is correct. |
2001 | The knowledge is not exist | Please check the external repository |