v1.0.0 does not support Rerank mode type in ollama. #9041

Closed
opened 2026-02-21 18:29:54 -05:00 by yindo · 0 comments
Owner

Originally created by @liudonghua123 on GitHub (Mar 4, 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.

Hi, I read the doc on https://zhuanlan.zhihu.com/p/691190576 and https://docs.dify.ai/zh-hans/learn-more/extended-reading/retrieval-augment/rerank, and I want to add a rerank mode.

I tested rerank-english-v3.0 mode of cohere. It's 403 when using the IP of China. I also found a ollama self hosted similar mode like [https://ollama.com/qllama/bge-reranker-large. But I can't add this mode as Rerank type of mode, if I added it as embedded type, I can't select it when choosing Rerank mode.

Image

Image

cohere_test.py
# https://docs.cohere.com/docs/compatibility-api
from openai import OpenAI

client = OpenAI(
    base_url="https://api.cohere.ai/compatibility/v1",
    api_key="COHERE_API_KEY",
)

completion = client.chat.completions.create(
    model="command-r7b-12-2024",
    messages=[
        {
            "role": "user",
            "content": "Write a haiku about recursion in programming.",
        },
    ],
)

print(completion.choices[0].message)

Maybe we need to add more support types like Rerank,Speech2text,TTS for ollama like Xorbits Inference.

2. Additional context or comments

Log Details
nginx-1          | 192.168.144.1 - - [04/Mar/2025:06:50:47 +0000] "GET /console/api/datasets/3a78988f-6237-42eb-9d43-f7ea1513d58e/batch/20250304065034459370/indexing-status HTTP/1.1" 200 1083 "http://dify.app.ynu.edu.cn/datasets/3a78988f-6237-42eb-9d43-f7ea1513d58e/documents" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0" "113.55.126.49"
plugin_daemon-1  | [GIN] 2025/03/04 - 06:50:48 | 200 |  586.037148ms |  192.168.144.11 | POST     "/plugin/ffbb405d-3e9f-4a58-868c-ce210c7c1864/dispatch/model/validate_model_credentials"
api-1            | 2025-03-04 06:50:48.011 ERROR [Dummy-179] [models.py:162] - Failed to save model credentials, tenant_id: ffbb405d-3e9f-4a58-868c-ce210c7c1864, model: command-r7b-12-2024, model_type: llm
api-1            | Traceback (most recent call last):
api-1            |   File "/app/api/controllers/console/workspace/models.py", line 154, in post
api-1            |     model_provider_service.save_model_credentials(
api-1            |   File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials
api-1            |     provider_configuration.add_or_update_custom_model_credentials(
api-1            |   File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials
api-1            |     provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials)
api-1            |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1            |   File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate
api-1            |     credentials = model_provider_factory.model_credentials_validate(
api-1            |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
api-1            |   File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate
api-1            |     self.plugin_model_manager.validate_model_credentials(
api-1            |   File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials
api-1            |     for resp in response:
api-1            |                 ^^^^^^^^
api-1            |   File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream
api-1            |     self._handle_plugin_daemon_error(error.error_type, error.message)
api-1            |   File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error
api-1            |     raise CredentialsValidateFailedError(error_object.get("message"))
api-1            | core.model_runtime.errors.validate.CredentialsValidateFailedError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden
nginx-1          | 192.168.144.1 - - [04/Mar/2025:06:50:48 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/cohere/cohere/models HTTP/1.1" 400 218 "http://dify.app.ynu.edu.cn/explore/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0" "113.55.127.140"

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @liudonghua123 on GitHub (Mar 4, 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. Hi, I read the doc on https://zhuanlan.zhihu.com/p/691190576 and https://docs.dify.ai/zh-hans/learn-more/extended-reading/retrieval-augment/rerank, and I want to add a rerank mode. I tested [`rerank-english-v3.0`](https://docs.cohere.com/docs/rerank-2) mode of cohere. It's 403 when using the IP of China. I also found a ollama self hosted similar mode like [https://ollama.com/[qllama/bge-reranker-large](https://ollama.com/qllama/bge-reranker-large). But I can't add this mode as Rerank type of mode, if I added it as embedded type, I can't select it when choosing Rerank mode. ![Image](https://github.com/user-attachments/assets/b7516a6f-9521-490b-9b54-2771612b1bbf) ![Image](https://github.com/user-attachments/assets/556fd5b9-ac19-4811-9e4e-72dcbe513907) <details><summary>cohere_test.py</summary> ```py # https://docs.cohere.com/docs/compatibility-api from openai import OpenAI client = OpenAI( base_url="https://api.cohere.ai/compatibility/v1", api_key="COHERE_API_KEY", ) completion = client.chat.completions.create( model="command-r7b-12-2024", messages=[ { "role": "user", "content": "Write a haiku about recursion in programming.", }, ], ) print(completion.choices[0].message) ``` </details> Maybe we need to add more support types like `Rerank`,`Speech2text`,`TTS` for ollama like `Xorbits Inference`. ### 2. Additional context or comments <details><summary>Log Details</summary> ``` nginx-1 | 192.168.144.1 - - [04/Mar/2025:06:50:47 +0000] "GET /console/api/datasets/3a78988f-6237-42eb-9d43-f7ea1513d58e/batch/20250304065034459370/indexing-status HTTP/1.1" 200 1083 "http://dify.app.ynu.edu.cn/datasets/3a78988f-6237-42eb-9d43-f7ea1513d58e/documents" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0" "113.55.126.49" plugin_daemon-1 | [GIN] 2025/03/04 - 06:50:48 | 200 | 586.037148ms | 192.168.144.11 | POST "/plugin/ffbb405d-3e9f-4a58-868c-ce210c7c1864/dispatch/model/validate_model_credentials" api-1 | 2025-03-04 06:50:48.011 ERROR [Dummy-179] [models.py:162] - Failed to save model credentials, tenant_id: ffbb405d-3e9f-4a58-868c-ce210c7c1864, model: command-r7b-12-2024, model_type: llm api-1 | Traceback (most recent call last): api-1 | File "/app/api/controllers/console/workspace/models.py", line 154, in post api-1 | model_provider_service.save_model_credentials( api-1 | File "/app/api/services/model_provider_service.py", line 237, in save_model_credentials api-1 | provider_configuration.add_or_update_custom_model_credentials( api-1 | File "/app/api/core/entities/provider_configuration.py", line 406, in add_or_update_custom_model_credentials api-1 | provider_model_record, credentials = self.custom_model_credentials_validate(model_type, model, credentials) api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/entities/provider_configuration.py", line 386, in custom_model_credentials_validate api-1 | credentials = model_provider_factory.model_credentials_validate( api-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ api-1 | File "/app/api/core/model_runtime/model_providers/model_provider_factory.py", line 190, in model_credentials_validate api-1 | self.plugin_model_manager.validate_model_credentials( api-1 | File "/app/api/core/plugin/manager/model.py", line 137, in validate_model_credentials api-1 | for resp in response: api-1 | ^^^^^^^^ api-1 | File "/app/api/core/plugin/manager/base.py", line 189, in _request_with_plugin_daemon_response_stream api-1 | self._handle_plugin_daemon_error(error.error_type, error.message) api-1 | File "/app/api/core/plugin/manager/base.py", line 219, in _handle_plugin_daemon_error api-1 | raise CredentialsValidateFailedError(error_object.get("message")) api-1 | core.model_runtime.errors.validate.CredentialsValidateFailedError: status_code: 403, body: <!doctype html><meta charset="utf-8"><meta name=viewport content="width=device-width, initial-scale=1"><title>403</title>403 Forbidden nginx-1 | 192.168.144.1 - - [04/Mar/2025:06:50:48 +0000] "POST /console/api/workspaces/current/model-providers/langgenius/cohere/cohere/models HTTP/1.1" 400 218 "http://dify.app.ynu.edu.cn/explore/apps" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36 Edg/133.0.0.0" "113.55.127.140" ``` </details> ### 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 18:29:54 -05:00
yindo closed this issue 2026-02-21 18:29:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#9041