Retrieve knowledge from or store files into Dify knowledge bases using the Dify API.
Please add an external knowledge base in LangBot and select "DifyDatasetsConnector" as the knowledge retriever type.
- api_base_url: Base URL for Dify API
- For Dify Cloud:
https://api.dify.ai/v1(default) - For self-hosted instances: Your server URL (e.g.,
http://localhost/apiorhttps://your-domain.com/api)
- For Dify Cloud:
- dify_apikey: Your Dify API key from your Dify instance
- dataset_id: The ID of your Dify knowledge base/dataset
- search_method (default: semantic_search): The search method to use
keyword_search: Keyword-based searchsemantic_search: Semantic similarity search (default)full_text_search: Full-text searchhybrid_search: Hybrid search combining semantic and full-text
- top_k (default: 5): Maximum number of retrieved results
- score_threshold_enabled (default: false): Whether to enable score threshold filtering
- score_threshold (default: 0.5): Minimum relevance score (0-1), only shown when score threshold is enabled
- reranking_enable (default: false): Enable reranking to improve result quality. The reranking model is automatically fetched from your Dify dataset settings — please configure the reranking model in the Dify console first
- Go to https://cloud.dify.ai/
- Navigate to your knowledge base page
- Click on "API ACCESS" in the left sidebar
- Create or copy your API key from the "API Keys" section
- In the Dify knowledge base list, click on your knowledge base
- The dataset ID is in the URL:
https://cloud.dify.ai/datasets/{dataset_id} - Or you can find it in the API documentation page of your knowledge base
- In the Dify console, go to your dataset settings
- Enable reranking and select a reranking model (e.g.,
cohere/rerank-v3.5) - Save the settings
- In LangBot, enable the "Enable Reranking" toggle — the plugin will automatically use the model configured in Dify
This plugin uses the Dify Dataset API:
- Retrieval:
POST /v1/datasets/{dataset_id}/retrieve - Dataset info:
GET /v1/datasets/{dataset_id} - Document upload:
POST /v1/datasets/{dataset_id}/document/create-by-file - Document delete:
DELETE /v1/datasets/{dataset_id}/documents/{document_id} - Documentation: https://docs.dify.ai/
This version remains dedicated. SDK 0.7.4 shared singleton placement requires a
signed stateless-v1 component model, not just shared-runtime-v1.
The existing per-installation mutation state and cancellation model have
not passed that contract. See the audit.