Dify can't enable knowledge graph search method in RAGFlow when using RAGFlow as an external knowledge base #12150

Closed
opened 2026-02-21 19:06:02 -05:00 by yindo · 5 comments
Owner

Originally created by @WhitePlusMS on GitHub (Mar 26, 2025).

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Hello everyone, I'm trying to use RAGFlow as an external knowledge base for a RAG retrieval task.
I'm using Dify 1.1.3 and 0.15.3, RAGFlow version v0.17.2 slim
Knowledge graphs can be generated in RAGFlow, I have successfully connected to the RAGFlow knowledge base in Dify and successfully tested the search, and I was able to get the results of the search with or without using rerank model.
But when I try to call "Use Knowledge Graph" in Dify, I find that Dify's recall settings interface does not provide a corresponding enable button.

Image

I looked at the source code of RAGFlow, Dify uses this interface when calling RAGFlow knowledge base

#RAGFlow
#./api/apps/sdk/dify_retrieval.py

@manager.route('/dify/retrieval', methods=['POST'])  # noqa: F821
@apikey_required
@validate_request("knowledge_id", "query")
def retrieval(tenant_id):
    req = request.json
    question = req["query"]
    kb_id = req["knowledge_id"]
    use_kg = req.get("use_kg", False)
    ...
        if use_kg:
            ck = settings.kg_retrievaler.retrieval(question,
                                                   [tenant_id],
                                                   [kb_id],
                                                   embd_mdl,
                                                   LLMBundle(kb.tenant_id, LLMType.CHAT))

and it requires the use_kg = req.get("use_kg", False) parameter to enable the Knowledge Graph feature, which is False by default in RAGFlow.
Then I looked at the source code of Dify, take the recall test interface of the knowledge base as an example

# web/app/components/datasets/hit-testing/textarea.tsx
  const externalRetrievalTestingOnSubmit = async () => {
    setLoading(true)
    const [e, res] = await asyncRunSafe<ExternalKnowledgeBaseHitTestingResponse>(
      externalKnowledgeBaseHitTesting({
         # Only the following parameters were sent
        datasetId,
        query: text,
        external_retrieval_model: {
          top_k: externalRetrievalSettings.top_k,
          score_threshold: externalRetrievalSettings.score_threshold,
          score_threshold_enabled: externalRetrievalSettings.score_threshold_enabled,
        },
      }) as Promise<ExternalKnowledgeBaseHitTestingResponse>,
    )
    if (!e) {
      setExternalHitResult(res)
      onUpdateList?.()
    }
    setLoading(false)
  }

and there are no Knowledge Graph parameters enabled on the sender side of Dify, which means that Dify cannot use RAGFlow's Knowledge Graph retrieval function when using RAGFlow as an external database. I found this issue in both Dify 1.1.3 and 0.15.3 versions

Will there be any plans for improvement this function in the future?

Thanks, and I'm new to Dify, if the problem isn't here, is there a relevant solution?

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @WhitePlusMS on GitHub (Mar 26, 2025). ### Self Checks - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. Hello everyone, I'm trying to use RAGFlow as an external knowledge base for a RAG retrieval task. I'm using Dify 1.1.3 and 0.15.3, RAGFlow version v0.17.2 slim Knowledge graphs can be generated in RAGFlow, I have successfully connected to the RAGFlow knowledge base in Dify and successfully tested the search, and I was able to get the results of the search with or without using rerank model. But when I try to call "Use Knowledge Graph" in Dify, I find that Dify's recall settings interface does not provide a corresponding enable button. ![Image](https://github.com/user-attachments/assets/d5bf6e29-ffdc-44ff-82ff-ab508dd6cde5) I looked at the source code of RAGFlow, Dify uses this interface when calling RAGFlow knowledge base ```python #RAGFlow #./api/apps/sdk/dify_retrieval.py @manager.route('/dify/retrieval', methods=['POST']) # noqa: F821 @apikey_required @validate_request("knowledge_id", "query") def retrieval(tenant_id): req = request.json question = req["query"] kb_id = req["knowledge_id"] use_kg = req.get("use_kg", False) ... if use_kg: ck = settings.kg_retrievaler.retrieval(question, [tenant_id], [kb_id], embd_mdl, LLMBundle(kb.tenant_id, LLMType.CHAT)) ``` and it requires the `use_kg = req.get("use_kg", False)` parameter to enable the Knowledge Graph feature, which is False by default in RAGFlow. Then I looked at the source code of Dify, take the recall test interface of the knowledge base as an example ```python # web/app/components/datasets/hit-testing/textarea.tsx const externalRetrievalTestingOnSubmit = async () => { setLoading(true) const [e, res] = await asyncRunSafe<ExternalKnowledgeBaseHitTestingResponse>( externalKnowledgeBaseHitTesting({ # Only the following parameters were sent datasetId, query: text, external_retrieval_model: { top_k: externalRetrievalSettings.top_k, score_threshold: externalRetrievalSettings.score_threshold, score_threshold_enabled: externalRetrievalSettings.score_threshold_enabled, }, }) as Promise<ExternalKnowledgeBaseHitTestingResponse>, ) if (!e) { setExternalHitResult(res) onUpdateList?.() } setLoading(false) } ``` and there are no Knowledge Graph parameters enabled on the sender side of Dify, which means that Dify cannot use RAGFlow's Knowledge Graph retrieval function when using RAGFlow as an external database. I found this issue in both Dify 1.1.3 and 0.15.3 versions Will there be any plans for improvement this function in the future? Thanks, and I'm new to Dify, if the problem isn't here, is there a relevant solution? ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 💪 enhancement👻 feat:rag labels 2026-02-21 19:06:02 -05:00
yindo closed this issue 2026-02-21 19:06:02 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Apr 26, 2025):

Hi, @WhitePlusMS. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • You reported an issue with enabling the "Use Knowledge Graph" feature in Dify when using RAGFlow as an external knowledge base.
  • The connection to RAGFlow is successful, and searches can be tested.
  • The Dify interface lacks an option to activate the "Use Knowledge Graph" feature, which is needed for the use_kg parameter in the RAGFlow API.
  • No comments or further activity have been made on this issue.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If there is no further activity, this issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Apr 26, 2025): Hi, @WhitePlusMS. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - You reported an issue with enabling the "Use Knowledge Graph" feature in Dify when using RAGFlow as an external knowledge base. - The connection to RAGFlow is successful, and searches can be tested. - The Dify interface lacks an option to activate the "Use Knowledge Graph" feature, which is needed for the `use_kg` parameter in the RAGFlow API. - No comments or further activity have been made on this issue. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of the Dify repository by commenting here. - If there is no further activity, this issue will be automatically closed in 15 days. Thank you for your understanding and contribution!
Author
Owner

@WhitePlusMS commented on GitHub (Apr 26, 2025):

In DIFY 1.2.0, this problem has not been solved, and my personal solution is to directly use the HTTP node in DIFY to implement query operations with knowledge graph through the relevant API interface of POST RAGFlow

@WhitePlusMS commented on GitHub (Apr 26, 2025): In DIFY 1.2.0, this problem has not been solved, and my personal solution is to directly use the HTTP node in DIFY to implement query operations with knowledge graph through the relevant API interface of POST RAGFlow
Author
Owner

@dosubot[bot] commented on GitHub (Apr 26, 2025):

@crazywoola, the user @WhitePlusMS has indicated that the issue with enabling the "Use Knowledge Graph" feature in Dify is still relevant in version 1.2.0 and has shared a workaround using the HTTP node. Could you please assist them with this issue?

@dosubot[bot] commented on GitHub (Apr 26, 2025): @crazywoola, the user @WhitePlusMS has indicated that the issue with enabling the "Use Knowledge Graph" feature in Dify is still relevant in version 1.2.0 and has shared a workaround using the HTTP node. Could you please assist them with this issue?
Author
Owner

@nicklongs commented on GitHub (Aug 12, 2025):

在DIFY 1.2.0中,这个问题还没有解决,我个人的解决方案是直接使用DIFY中的HTTP节点,通过POST RAGFlow的相关API接口,实现知识图谱的查询操作

请问下用的ragflow的什么接口实现的 ?ragflow的版本是多少啊?

@nicklongs commented on GitHub (Aug 12, 2025): > 在DIFY 1.2.0中,这个问题还没有解决,我个人的解决方案是直接使用DIFY中的HTTP节点,通过POST RAGFlow的相关API接口,实现知识图谱的查询操作 请问下用的ragflow的什么接口实现的 ?ragflow的版本是多少啊?
Author
Owner

@hulongan commented on GitHub (Oct 23, 2025):

Can setting the parameter use_kg in the RAGFlow source code to true and restarting docker solve the problem of calling the knowledge graph function in dify?

@hulongan commented on GitHub (Oct 23, 2025): Can setting the parameter use_kg in the RAGFlow source code to true and restarting docker solve the problem of calling the knowledge graph function in dify?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12150