mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
Two bugs regarding custom Extendtion to support external knowledge bases #869
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Michael-C-H on GitHub (Dec 11, 2025).
Self Checks
Dify version
1.10.1
Plugin version
0.0.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
First of all, I would like to express my sincere gratitude to the official for launching the llamaCloud plugin, which has provided me with ideas and references for using other knowledge bases as external knowledge bases for dify.
During the development of my own Extendtion, I discovered the following two issues, both related to score_threshold:
✔️ Error log
No response
@dosubot[bot] commented on GitHub (Dec 11, 2025):
Hi @Michael-C-H! I'm Dosu and I’m helping the dify-official-plugins team.
Here’s what’s happening with the two bugs:
In the llamaCloud plugin, there’s a typo in the filtering logic: instead of using the string key
"score_threshold", the code uses the variablescore_thresholdas a key when callingretrieval_settings.get(score_threshold, .0). This means it always returns0.0and never uses the actual configured threshold. To fix this, change the filtering line to use either the string key or the previously extracted variable, likeif node.score < score_threshold:orretrieval_settings.get("score_threshold", 0.0)(source).For custom extensions, the reason
retrieval_settings.get("score_threshold")always returns0is that Dify only forwards the configured threshold ifscore_threshold_enabledis set totruein the dataset’s retrieval model. Otherwise, it forces the value to0.0(source). Make sure you enablescore_threshold_enabledin your dataset configuration or knowledge base UI to pass the actual value.Let me know if you need help with the exact code changes or configuration steps!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
@Michael-C-H commented on GitHub (Dec 11, 2025):
The knowledge base is set up as follows:
The source code of extendtion is as follows:

The results of the recall test are as follows:

@dosu
@dosubot[bot] commented on GitHub (Dec 11, 2025):
Your knowledge base UI and extension code look correct, but the recall test results show that results below the score_threshold (0.5) are not being filtered out. Here’s what to check:
There was a known UI bug where the score threshold input box only accepted 0 or 1, but the slider allows float values like 0.5. Make sure you set the threshold using the slider, not the input box or arrows, to ensure a float value is saved and sent downstream. You can confirm this by re-saving the setting with the slider and testing again (details).
In Dify’s backend, score_threshold is only forwarded to your extension if score_threshold_enabled is true. If you see results below the threshold, add a debug log in your extension to print the value and type of score_threshold received at runtime. This will confirm if the extension is actually getting 0.5 or just 0.0 (backend logic).
Double-check your filtering logic: ensure you’re comparing floats, not strings, and that the filter is applied before returning results. For example:
If the value is correct and the logic is correct, but results below the threshold are still returned, the issue may be with the vector search API or a post-processing step ignoring the filter. In that case, add logging before and after filtering to see what’s happening.
Let me know what your debug output shows or if you need help with the logging code!
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other