Agent won't use knowledge I added #13195

Closed
opened 2026-02-21 19:11:02 -05:00 by yindo · 4 comments
Owner

Originally created by @harrywang on GitHub (Apr 21, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • 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.

Dify version

v1.2.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I added a knowledge to an agent using gpt 4o - no matter what I say, it won't search the knowledge:

such as "search knowledge to answer" won't work.

Image

When I change to Claude 3.5 sonnet, it works. But I want to know if I want to use gpt 4o or 4o mini - anything I can do to trigger the Knowledge function call.

✔️ Expected Behavior

I can ask the agent to use Knowledge to answer questions.

Actual Behavior

it does not use knowledge.

Originally created by @harrywang on GitHub (Apr 21, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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. ### Dify version v1.2.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I added a knowledge to an agent using gpt 4o - no matter what I say, it won't search the knowledge: such as "search knowledge to answer" won't work. <img width="2281" alt="Image" src="https://github.com/user-attachments/assets/c99ffa1d-a034-4ba2-8f68-fdb143a51227" /> When I change to Claude 3.5 sonnet, it works. But I want to know if I want to use gpt 4o or 4o mini - anything I can do to trigger the Knowledge function call. ### ✔️ Expected Behavior I can ask the agent to use Knowledge to answer questions. ### ❌ Actual Behavior it does not use knowledge.
yindo added the 🐞 bug label 2026-02-21 19:11:02 -05:00
yindo closed this issue 2026-02-21 19:11:02 -05:00
Author
Owner

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

To address the issue where GPT 4o is not using the knowledge base in Dify, you can check the following:

  1. Configuration Settings: Ensure that the configuration settings for knowledge search functionality are correctly set up for GPT 4o. This includes using the correct knowledge_id, setting the query, and configuring the retrival_setting with appropriate top_k and score_threshold values. These settings are crucial for the knowledge base to function properly [1].

  2. Agent Mode Configuration: When using a knowledge base in Dify's agent mode, make sure you have provided a detailed description of the knowledge base tool and explicit instructions for the LLM to retrieve information from it. This helps the model understand when to use the knowledge base [2].

  3. Debugging and Logs: Check if there are any specific logs or error messages generated when GPT 4o attempts to use the knowledge base. This can provide insights into what might be going wrong.

  4. Version Compatibility: Verify that there are no known compatibility issues between GPT 4o and the knowledge base integration in the current version of Dify. Although no specific issues were found in the available data, it's worth checking for any updates or patches that might address this problem.

If these steps do not resolve the issue, consider comparing the configuration and setup with those used for Claude 3.5 sonnet, as it seems to work correctly in your setup.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Apr 21, 2025): <!-- Answer --> To address the issue where GPT 4o is not using the knowledge base in Dify, you can check the following: 1. **Configuration Settings**: Ensure that the configuration settings for knowledge search functionality are correctly set up for GPT 4o. This includes using the correct `knowledge_id`, setting the `query`, and configuring the `retrival_setting` with appropriate `top_k` and `score_threshold` values. These settings are crucial for the knowledge base to function properly <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/jp/.gitbook/assets/Dify-test.openapi.jp.json)</sup>. 2. **Agent Mode Configuration**: When using a knowledge base in Dify's agent mode, make sure you have provided a detailed description of the knowledge base tool and explicit instructions for the LLM to retrieve information from it. This helps the model understand when to use the knowledge base <sup>[[2]](https://github.com/langgenius/dify/issues/18331)</sup>. 3. **Debugging and Logs**: Check if there are any specific logs or error messages generated when GPT 4o attempts to use the knowledge base. This can provide insights into what might be going wrong. 4. **Version Compatibility**: Verify that there are no known compatibility issues between GPT 4o and the knowledge base integration in the current version of Dify. Although no specific issues were found in the available data, it's worth checking for any updates or patches that might address this problem. If these steps do not resolve the issue, consider comparing the configuration and setup with those used for Claude 3.5 sonnet, as it seems to work correctly in your setup. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c3316da1-9b77-4ef2-ac0c-665455f5bfd2?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Apr 21, 2025):

Suggestion: refine the description of the knowledge.

@crazywoola commented on GitHub (Apr 21, 2025): Suggestion: refine the description of the knowledge.
Author
Owner

@harrywang commented on GitHub (Apr 21, 2025):

Suggestion: refine the description of the knowledge.

Thanks, you mean the following, correct? Any other way to prompt the agent to use the Knowledge?

Image
@harrywang commented on GitHub (Apr 21, 2025): > Suggestion: refine the description of the knowledge. Thanks, you mean the following, correct? Any other way to prompt the agent to use the Knowledge? <img width="1071" alt="Image" src="https://github.com/user-attachments/assets/5ae71d07-70f2-4953-87be-221462a8e2d1" />
Author
Owner

@crazywoola commented on GitHub (Apr 21, 2025):

Yes, when it's too short, the LLM will not be able to call it by it's description.

@crazywoola commented on GitHub (Apr 21, 2025): Yes, when it's too short, the LLM will not be able to call it by it's description.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#13195