dify icon indicating copy to clipboard operation
dify copied to clipboard

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

Open grapswiz opened this issue 1 year ago • 1 comments

Self Checks

  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [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.

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

  • https://github.com/langgenius/dify/issues/8081
  • https://github.com/langgenius/dify/pull/7549
  • https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deploy-models-cohere-rerank

3. Can you help us with this feature?

  • [ ] I am interested in contributing to this feature.

grapswiz avatar Oct 24 '24 08:10 grapswiz

I'm having the same problem

rudnypc avatar Oct 26 '24 14:10 rudnypc

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.

Zqsng6Zw avatar Oct 28 '24 14:10 Zqsng6Zw

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

nickjfrench avatar Oct 29 '24 13:10 nickjfrench

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

trantuthien avatar Nov 19 '24 08:11 trantuthien

Hi, @grapswiz. I'm Dosu, and I'm helping the Dify team manage their backlog. I'm marking this issue as stale.

Issue Summary

  • Original request for support of Cohere's Rerank model from Azure AI Studio in Dify.
  • Multiple users, including rudnypc and trantuthien, reported similar issues.
  • Zqsng6Zw suggested code changes to _azure_rerank() and _invoke() functions, noting JWT Token usage as a workaround.
  • Nickjfrench proposed broader API support for third-party models in Azure AI Studio.

Next Steps

  • Please confirm if this issue is still relevant to the latest version of the Dify repository by commenting here.
  • If there is no further activity, the issue will be automatically closed in 15 days.

Thank you for your understanding and contribution!

dosubot[bot] avatar Dec 20 '24 16:12 dosubot[bot]