0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Dify に Cohere Rerank (Azure AI Foundry 経由)を追加して RAG の精度を上げる

Last updated at Posted at 2025-10-18

Azure AI Foundry で提供されている Rerank モデルである Cohere Rerank を Dify に追加して、RAG の検索精度を上げる方法を紹介します。

通常、Dify で Cohere Rerank を使用する場合は Cohere の公式 API と Cohere プラグイン を使いますが、データを Cohere に送信したくない 場面では、Azure 上でホストされる Cohere Rerank を使う選択肢があります。この記事ではその導入手順と注意点をまとめます。

動作環境(筆者検証)

  • Dify 1.9.1(Docker Compose)
  • Azure サブスクリプション

Step 1. Azure AI Hub を作成

1. Azure Portal で AI Foundry にアクセス
2. Hub を新規作成

image.png

3. 必須項目を入力(リージョンは Cohere Rerank 3.5 が使用可能な East US 2 を選択)
4. (任意) VM などからのプライベート接続のみを許可したい場合は「Inbound Acccess」タブでプライベートエンドポイントを作成
5. 「確認および作成」を押下

image.png

6. 「作成」を押下
image.png

7. デプロイ完了後「リソースに移動」を押下
image.png

8. 「設定」 → 「ネットワーク」 を選択
image.png

9. 「全てのネットワークから有効」を選択して「保存」を押下
image.png

初期状態ではパブリックアクセスが 無効 に設定されているため Azure AI Foundry ポータルに入れません
image.png

10. 「概要」 → 「Launch Azure AI Foundry」
image.png

Step 2. Cohere Rerank モデルをデプロイ

1. 「Models + endpoints」 → 「モデルのデプロイ」 → 「基本モデルをデプロイする」
image.png

2. 「Cohere-rerank-v3.5」を選択して「確認」を押下
image.png

3. 「サーバーレス API」を選択
image.png

4. 「続行」を選択
image.png

5. 「新しいプロジェクトの作成」を押下
image.png

6. プロジェクト名を入力して「作成」を押下
image.png

7. 「サブスクライブとデプロイ」を押下
image.png

8. デプロイ名を入力して「デプロイ」を押下
image.png

9. デプロイ完了。エンドポイントの「キー」と 「API ルート」は次のステップで使います
image.png

Step 3. Dify に Cohere Rerank を登録

1. Dify のプラグインから「Azure AI Studio」をインストール
image.png

2. 「インストール」を押下
image.png

3. 画面右上のアイコン → 「設定」を押下
image.png

4. 次のように入力して「追加」を押下

項目 設定値
Model Name Cohere Rerank 3.5
Model Type Rerank
Azure AI Studio Endpoint Step 2 の「APIルート」
JWT Token Step 2 の「キー」

image.png

5. 「システムモデル設定」 → 「Rerank モデル」に「Cohere Rerank 3.5」を設定 → 「保存」
image.png

6. ナレッジベースの検索設定で Rerank モデルが選択できるようになります
image.png

本当にデータは Azure の外に出ないの?

※Azure AI Foundry 利用時

All models offered in Foundry Models are hosted in Microsoft's Azure environment. The service doesn't interact with any external services or model provider.
Configure access to Models from Partners and Community | Microsoft Learn

If customers purchase or use our Services through a third party’s managed machine learning platform or service (for example, via AWS, GCP, or Azure), Cohere will not have access to and does not store or process any personal information that customers may provide regarding their own end users.
Privacy Policy | Cohere

  • 上記のとおり、Azure AI Foundry のモデルは Azure 上でホストされ、外部サービスやモデル提供者と直接やり取りしない旨が明記されています
  • Cohere も、Azure などの外部プラットフォーム経由で利用される場合は、ユーザー企業のエンドユーザー個人情報にアクセス・保存・処理しないとしています(連絡用のビジネス連絡先情報のみ)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?