langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
53.18k stars 7.76k forks source link

Enable Use of Cohere's Rerank Model from Azure AI Studio in #9780

Open grapswiz opened 1 month ago

grapswiz commented 1 month ago

Self Checks

1. Is this request related to a challenge you're experiencing? Tell me about your story.

Yes, I tried to use Cohere's Rerank model from Azure AI Studio for reranking search results, but Dify does not support this model, so I was unable to use it. Since we operate all of our resources on Azure, not being able to use this feature affects our operational efficiency. Enabling the Rerank model would allow us to centralize resource management on Azure, providing significant benefits in terms of security and cost management.

2. Additional context or comments

3. Can you help us with this feature?

rudnypc commented 1 month ago

I'm having the same problem

Zqsng6Zw commented 1 month ago

There are several points in api/core/model_runtime/model_providers/azure_ai_studio/rerank/rerank.py that are not in line with the actual situation.

  1. in _azure_rerank(), you need to pass "query” and “documents” keys for body, not "inputs" and "docs".
  2. in _invoke(), the expected result format is different from the actual one and needs to be corrected.
  3. What I entered as a JWT Token is being used as just an API key, but it is working correctly.

I'm not sure if this is the right way to handle the problem, though it seems to be working for the time being in my environment.

nickjfrench commented 1 month ago

Second this request. Not just Cohere, but enable APIs from any third-party model deployed in Azure AI Studio.

trantuthien commented 1 week ago

I'm having the same problem too. Can not use Re-rank model