Add rerank model occour 400 error when using GPUStack langgenius/dify#14069 #76

Closed
opened 2026-02-16 10:18:00 -05:00 by yindo · 6 comments
Owner

Originally created by @liuw518 on GitHub (Mar 13, 2025).

This PR is going to:

  • change model API path from v1-openai to v1
  • Add timeout configuration for rerank model
  • update model plugin docs.

The problem still exists after the update
image

image

2025-03-13 16:25:15.370 ERROR [Dummy-14] [models.py:162] - Failed to save model credentials, tenant_id: c9e64c48-10ae-4c43-8829-dfb2992809dc, model: bge-reranker-v2-m3, model_type: rerank
Traceback (most recent call last):
File "/app/api/controllers/console/workspace/models.py", line 154, in post
model_provider_service.save_model_credentials(
File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
provider_configuration.add_or_update_custom_model_credentials(
File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials
provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate
credentials = model_provider_factory.model_credentials_validate(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate
self.plugin_model_manager.validate_model_credentials(
File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
for resp in response:
^^^^^^^^
File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
self._handle_plugin_daemon_error(error.error_type, error.message)
File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
raise CredentialsValidateFailedError(error_object.get("message"))
core.model_runtime.errors.validate.CredentialsValidateFailedError: 400 Client Error: Bad Request for url: http://172.16.0.217/v1/rerank

Originally posted by @liuw518 in https://github.com/langgenius/dify-official-plugins/issues/382#issuecomment-2721883119

Originally created by @liuw518 on GitHub (Mar 13, 2025). > This PR is going to: > > * change model API path from `v1-openai` to `v1` > * Add timeout configuration for `rerank` model > * update model plugin docs. The problem still exists after the update <img width="1558" alt="image" src="https://github.com/user-attachments/assets/f55804f8-94ca-4b28-b5f3-9b7c380b3208" /> <img width="1133" alt="image" src="https://github.com/user-attachments/assets/6670406b-345f-4e5b-ae0a-23493eb2f124" /> 2025-03-13 16:25:15.370 ERROR [Dummy-14] [models.py:162] - Failed to save model credentials, tenant_id: c9e64c48-10ae-4c43-8829-dfb2992809dc, model: bge-reranker-v2-m3, model_type: rerank Traceback (most recent call last): File "/app/api/controllers/console/workspace/models.py", line 154, in post model_provider_service.save_model_credentials( File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials provider_configuration.add_or_update_custom_model_credentials( File "/app/api/core/entities/provider_configuration.py", line 422, in add_or_update_custom_model_credentials provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/entities/provider_configuration.py", line 402, in custom_model_credentials_validate credentials = model_provider_factory.model_credentials_validate( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 191, in model_credentials_validate self.plugin_model_manager.validate_model_credentials( File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials for resp in response: ^^^^^^^^ File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream self._handle_plugin_daemon_error(error.error_type, error.message) File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error raise CredentialsValidateFailedError(error_object.get("message")) core.model_runtime.errors.validate.CredentialsValidateFailedError: 400 Client Error: Bad Request for url: http://172.16.0.217/v1/rerank _Originally posted by @liuw518 in https://github.com/langgenius/dify-official-plugins/issues/382#issuecomment-2721883119_
yindo closed this issue 2026-02-16 10:18:00 -05:00
Author
Owner

@liuw518 commented on GitHub (Mar 13, 2025):

using the same api-key to create an Embedding Model, everything is OK.
but when creating Rerank Model, 400 error ...

@liuw518 commented on GitHub (Mar 13, 2025): using the same api-key to create an Embedding Model, everything is OK. but when creating Rerank Model, 400 error ...
Author
Owner

@xiaoyan88 commented on GitHub (Mar 15, 2025):

Image

@xiaoyan88 commented on GitHub (Mar 15, 2025): ![Image](https://github.com/user-attachments/assets/fc873d95-80c0-4ba1-8dbd-70be5211dca2)
Author
Owner

@xiaoyan88 commented on GitHub (Mar 15, 2025):

Image

Add this line of code, otherwise dify will pass 'top_n=None' and repack it into difypkg.

@xiaoyan88 commented on GitHub (Mar 15, 2025): > ![Image](https://github.com/user-attachments/assets/fc873d95-80c0-4ba1-8dbd-70be5211dca2) Add this line of code, otherwise dify will pass 'top_n=None' and repack it into difypkg.
Author
Owner

@liuw518 commented on GitHub (Mar 17, 2025):

Image

Add this line of code, otherwise dify will pass 'top_n=None' and repack it into difypkg.

According to the method you provided, the problem has been solved after modification, thinks !!!!

@liuw518 commented on GitHub (Mar 17, 2025): > > ![Image](https://github.com/user-attachments/assets/fc873d95-80c0-4ba1-8dbd-70be5211dca2) > > Add this line of code, otherwise dify will pass 'top_n=None' and repack it into difypkg. According to the method you provided, the problem has been solved after modification, thinks !!!!
Author
Owner

@linyinli commented on GitHub (Apr 3, 2025):

Fixed in 0.0.5.

@linyinli commented on GitHub (Apr 3, 2025): Fixed in 0.0.5.
Author
Owner

@dosubot[bot] commented on GitHub (Aug 19, 2025):

Hi, @liuw518. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported a 400 error when creating a Rerank Model with the GPU stack due to 'top_n=None' handling in the dify package.
  • Contributor xiaoyan88 suggested a code fix to prevent improper repacking of 'top_n'.
  • You confirmed that the suggested fix resolved the issue.
  • Maintainer linyinli included the fix in version 0.0.5 of the package.

What's Next:

  • Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here.
  • Otherwise, I will automatically close this issue in 5 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 19, 2025): Hi, @liuw518. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. Issue Summary: - You reported a 400 error when creating a Rerank Model with the GPU stack due to 'top_n=None' handling in the dify package. - Contributor xiaoyan88 suggested a code fix to prevent improper repacking of 'top_n'. - You confirmed that the suggested fix resolved the issue. - Maintainer linyinli included the fix in version 0.0.5 of the package. What's Next: - Please let me know if this issue is still relevant with the latest version of dify-official-plugins by commenting here. - Otherwise, I will automatically close this issue in 5 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#76