mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
When add rerank modle "Qwen3-Reranker-4B" by XInference plugin, report error "score :input should be a valid number.." #611
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 @kanjoe888 on GitHub (Sep 2, 2025).
Self Checks
Dify version
1.7.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
when I add rerank model "Qwen3-Reranker-4B" by XInference, system report error, then infomation see after, when I add rerank model"bge-reranker-v2-m3", it is normal. i had asked deepseek , it say the reques param need include parameter" score ", and it't type must be float.
I requst the model "Qwen3-Reranker-4B" with xinference 's command line, it can response normal, so i adjust this is the plug's problem :
curl -X 'POST'
'http://0.0.0.0:9997/v1/rerank'
-H 'accept: application/
json'
-H 'Content-Type: application/json'
-d '{
"model": "Qwen3-Reranker-4B",
"query": "人工智能的发展历史",
"documents": [
"AI 起源于 1950 年代图灵测试",
"深度学习在 2012 年取得突破",
"大语言模型如 GPT-3 于 2020 年发布"
]
}'
{"id":"cde7f612-87d1-11f0-a9bc-926b820a47cc","results":[{"index":1,"relevance_score":null,"document":null},{"index":0,"relevance_score":null,"document":null},{"index":2,"relevance_score":0.0012444494059309363,"document":null}],"meta":{"api_version":null,"billed_units":null,"tokens":null,"warnings":null}}%
======>
2025-09-02 09:09:45.075 ERROR [Dummy-38] [base.py:211] - Error in stream reponse for plugin {'code': -500, 'message': '{"message":"{\"args\":{},\"error_type\":\"CredentialsValidateFailedError\",\"message\":\"[models] Bad Request Error, 1 validation error for RerankDocument\\nscore\\n Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]\\n For further information visit https://errors.pydantic.dev/2.11/v/float_type\"}","error_type":"PluginInvokeError","args":null}', 'data': None}
2025-09-02 09:09:45.075 ERROR [Dummy-38] [models.py:163] - Failed to save model credentials, tenant_id: c67846c0-48f9-49a9-8d20-7ae5095fee39, model: Qwen3-Reranker-4B, model_type: rerank
Traceback (most recent call last):
File "/app/api/controllers/console/workspace/models.py", line 155, in post
File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials
File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate
File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate
File "/app/api/core/plugin/impl/model.py", line 137, in validate_model_credentials
File "/app/api/core/plugin/impl/base.py", line 212, in _request_with_plugin_daemon_response_stream
File "/app/api/core/plugin/impl/base.py", line 242, in _handle_plugin_daemon_error
core.model_runtime.errors.validate.CredentialsValidateFailedError: [models] Bad Request Error, 1 validation error for RerankDocument
score
Input should be a valid number [type=float_type, input_value=None, input_type=NoneType]
nginx
✔️ Expected Behavior
normal to add rerank model "Qwen3-Reranker-4B"
❌ Actual Behavior
No response
@dosubot[bot] commented on GitHub (Sep 2, 2025):
The error happens because Dify expects each reranked document to have a
scorefield of type float, but the XInference plugin (or the Qwen3-Reranker-4B model) sometimes returnsrelevance_score: nullfor some documents. The plugin passes this asscore: None, which fails validation in Dify—scoremust always be a valid float, never null or missing. This is whybge-reranker-v2-m3works (it always returns a float), but Qwen3-Reranker-4B does not.To fix this, you need to ensure the plugin (or a proxy) transforms the response so that every document has a
scorefield (float), and skips or filters out any results whererelevance_scoreis null. There is no built-in mapping or config in Dify to acceptrelevance_scoreinstead ofscore—the plugin must provide the correct field and type. If you can't modify the plugin directly, you can use a proxy to rewrite the response JSON before it reaches Dify. Example (in JS):This will prevent the validation error and allow you to add the rerank model successfully. More details and similar cases are discussed here.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@dosubot[bot] commented on GitHub (Sep 2, 2025):
This error happens because the plugin passes a null value for the
scorefield when integrating Qwen3-Reranker-4B, but Dify strictly requiresscoreto be a valid float for each document. The upstream XInference response sometimes returnsrelevance_score: null, which causes the downstream validation to fail.To fix this, update the plugin code that processes rerank results so it maps any null
relevance_scoreto a default float (like0.0) before constructing theRerankDocumentobjects. This pattern is already used in other rerank integrations and prevents validation errors when scores are missing or null. You can see an example of this fix in PR #1493, which handles bothscoreandrelevance_scorefields and defaults to0if missing.There is no built-in configuration in Dify to handle null scores, so this code change (or a proxy that rewrites the response) is needed for robust integration with models that may return null scores.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
