alibabacloud-milvus-manage Skill を使用すると、自然言語コマンドでクラスターの作成、ステータス確認、パブリックネットワークアクセスの構成、コレクションの管理、およびテキスト・スカラー・ベクトル検索、BM25 全文検索、マルチパスハイブリッド検索を実行できます。さらに、テキストによる画像検索のための画像インポートや、クロスモーダル検索のための音声/動画の共同インポートといった主要機能も実装可能です。
前提条件
alibabacloud-milvus-manage Skill がインストール済みである必要があります。以下の場所から入手できます。
以下のクライアントで Skill をインストールできます。
Alibaba Cloud コマンドラインインターフェイス (CLI) が設定済みで、ID 認証が完了している必要があります。
aliyun configure listを実行して現在の設定を確認してください。Virtual Private Cloud (VPC) および vSwitch が準備済みである必要があります。Skill 実行時に既存のネットワークリソースを選択するよう案内されます。
Milvus サービスリンクロール (SLR) が作成済みである必要があります。Milvus を初めて使用する際は、AliyunServiceRoleForCloudMilvus および AliyunServiceRoleForMilvus を作成する必要があります。
ユースケース
alibabacloud-milvus-manage Skill は、クラスター管理とサービス検証の 2 つのカテゴリに分かれた、計 8 つのエンドツーエンド検証シナリオをカバーしています。
シナリオ 1:クラスター管理
クラスターの作成
Skill クライアントで自然言語コマンドを入力し、Milvus インスタンスを作成します。Skill は自動的に VPC および vSwitch を選択し、コンポーネントの仕様を構成したうえでインスタンスを作成します。
例となる Skill コマンド:
/alibabacloud-milvus-manage Create a Milvus instance of version 2.6 in Hangzhou zone J with password <custom_password>結果:
// Skill が自動的に VPC/VSwitch 選択およびコンポーネント仕様構成を完了し、create API を呼び出します
// 応答:
{"success": true, "data": {"instanceId": "c-xxxxxxxxxxxx****", "orderId": "28456242743****"}}
// 作成パラメーター:
// - リージョン:cn-hangzhou、ゾーン:cn-hangzhou-j
// - バージョン:2.6、仕様:standalone_pro、4 CU
// - 課金方法:従量課金制インスタンスステータスの確認
インスタンス作成後、Skill を使用して実行ステータス、エンドポイント、仕様詳細を確認します。
例となる Skill コマンド:
/alibabacloud-milvus-manage Check the creation status結果:
// Skill が list API および detail API を呼び出してインスタンスステータスをクエリします
インスタンスリスト:
c-xxxxxxxxxxxx**** | milvus-skill-test | status=running | v=2.6
インスタンス詳細:
- 内部エンドポイント:c-xxxxxxxxxxxx****-internal.milvus.aliyuncs.com
- ポート:19530
- 合計 CU:4
- インスタンスステータス:running(作成中から実行中に変化するまで約 3 分かかります)パブリックネットワークアクセスの有効化
インスタンスに対してパブリックネットワークアクセスを有効化し、ローカル開発またはテスト接続用に IP ホワイトリストを構成します。
例となる Skill コマンド:
/alibabacloud-milvus-manage Enable public network access for the cluster and add my local IP結果:
// Skill が自動的にローカル IP を取得し、updatePublicNetworkStatus API を呼び出します
パブリックネットワークアクセスが有効化されました:
- パブリックエンドポイント:c-xxxxxxxxxxxx****.milvus.aliyuncs.com:19530
- ホワイトリスト:<local_public_IP>/32コレクションのクエリ
インスタンスに接続し、すべてのコレクションの基本情報およびサンプルデータをクエリします。
例となる Skill コマンド:
/alibabacloud-milvus-manage Query all collections and show 3 records for each結果:
// Skill が pymilvus を使用してインスタンスに接続し、コレクションリストをクエリします
接続:MilvusClient(uri='http://c-xxxxxxxxxxxx****.milvus.aliyuncs.com:19530', token='root:***')
コレクションリスト:[](新規インスタンスにはコレクションが存在しないため、期待通りです)シナリオ 2:サービス検証
テキストインポートおよび検索検証
Milvus にテキストデータをインポートし、スカラー検索、ベクトル検索、ハイブリッド検索を検証します。Skill は AI Function 搭載の自動埋め込み機能によりコレクションを自動作成し、データを挿入したうえで複数種類の検索を実行します。
例となる Skill コマンド:
/alibabacloud-milvus-manage I have a <data_file_path>/articles.jsonl
file where each line contains title, content, and embedding fields. Import it into the article_db collection;
create it if it doesn't exist. After importing, randomly construct scalar search and vector search tests based on the file content<data_file_path> は JSONL ファイルの実際のパスに置き換えてください。ファイル内の各行は title および content フィールドを含む JSON オブジェクトです。
結果:
// Skill が自動的に article_db コレクションを作成(AI Function:text-embedding-v3、768 ディメンション)
// 10 件の記事レコードを挿入(テキストのみ提供され、埋め込みは自動生成)
コレクション作成完了:article_db
フィールド:id、title、content、embedding
AI Function:text-embedding-v3(dim=768)
データ挿入完了:10 レコードSkill は自動的に以下の検索検証を実行します:スカラー検索(フィールド値に基づく完全一致またはあいまい一致、例:title like "%vector%")、ベクトル検索(セマンティック類似性に基づく近似最近傍検索)、およびハイブリッド検索(ベクトル検索とスカラーフィルター条件の組み合わせ)。
Milvus AI Embedding を使用してベクトルデータ処理および検索を行うことを推奨します。
バージョン要件:Milvus インスタンスのバージョンは 2.6 以上である必要があります。
代替手段:現在のインスタンスバージョンがこの機能をサポートしていない場合は、事前処理済みのベクトルデータを提供してください。
// スカラー検索:title like "%vector%"
結果:「Introduction to Vector Databases」が見つかりました
// ベクトル検索:「What is machine learning and deep learning」
結果:
top1:「Summary of Machine Learning Algorithms」 (distance=0.7125)
top2:「Natural Language Processing Technologies」 (distance=0.5164)
top3:「Introduction to Vector Databases」 (distance=0.4779)
// ハイブリッド検索:「database technologies」 + filter='content like "%vector%"'
結果:
top1:「Introduction to Vector Databases」 (distance=0.6001)
top2:「Milvus Best Practices」 (distance=0.5276)全文検索およびハイブリッド検索
BM25 全文検索および text-embedding-v3 セマンティックベクトルの両方を構成したコレクションを作成し、複数の検索手法を組み合わせた効果を検証します。Milvus 2.6 の AI Function は BM25 と埋め込みの同時構成をサポートしており、生テキストを挿入するだけで両方のベクトルが自動生成されます。
例となる Skill コマンド:
/alibabacloud-milvus-manage I want to do Chinese full-text search in Milvus. Create a new collection with title
and content text fields, use BM25 for full-text search, and add text-embedding-v3 for semantic search with
1024 dimensions. After creation, insert all data from the file, then test vector search, scalar search, full-text + embedding
hybrid search, and full-text + scalar + vector hybrid search using content from the file結果:
// Skill が hybrid_search_test コレクションを作成
// BM25 Function(中国語アナライザー)および text-embedding-v3 AI Function(1024 ディメンション)を構成
// 10 件の記事レコードを挿入(テキストのみ提供され、BM25 疎ベクトルおよび埋め込み密ベクトルが自動生成)
コレクション作成完了:hybrid_search_test
BM25 Function:content_sparse(中国語アナライザー)
AI Function:text-embedding-v3(dim=1024)
データ挿入完了:10 レコードSkill は自動的に以下の 5 種類の検索検証を実行します:ベクトル検索(text-embedding-v3 に基づくセマンティック取得)、スカラー検索(フィールド値に基づくあいまい一致)、BM25 全文検索(BM25 アルゴリズムに基づくキーワード取得)、全文+埋め込みハイブリッド検索(BM25 およびベクトル検索を RRFRanker で融合)、および三方向ハイブリッド検索(BM25 +スカラーフィルター+ベクトル近似最近傍検索を RRFRanker で融合)。
// ベクトル検索:「How to build a semantic search system」
結果:
top1:「Introduction to Vector Databases」 (distance=0.5575)
top2:「Milvus Best Practices」 (distance=0.5402)
// スカラー検索:content like "%Milvus%"
結果:「Introduction to Vector Databases」と「Milvus Best Practices」が見つかりました
// BM25 全文検索:「vector database semantic search」
結果:
top1:「Introduction to Vector Databases」 (BM25 score=13.3037)
// 全文+埋め込みハイブリッド検索(RRFRanker):「deep learning and neural networks」
結果:
top1:「Summary of Machine Learning Algorithms」 (score=0.0328)
// 三方向ハイブリッド検索(BM25 +スカラーフィルター+ベクトル近似最近傍検索、RRFRanker):
// BM25=「index retrieval vector」、filter='title contains Milvus or vector'、ANN=「database indexing and retrieval technologies」
結果:
top1:「Introduction to Vector Databases」 (score=0.0325)
top2:「Milvus Best Practices」 (score=0.0325)イメージのインポートおよび検索
Milvus にイメージデータをインポートし、qwen3-vl-embedding マルチモーダル埋め込みモデルを通じて自動的に埋め込みを生成し、テキストによる画像検索を検証します。この例で使用する画像はこちらからダウンロードできます。
例となる Skill コマンド:
/alibabacloud-milvus-manage Import all images from the <image_directory_path>/banana
directory, then try searching with "yellow banana"<image_directory_path> はイメージディレクトリの実際のパスに置き換えてください。Milvus サーバーはイメージ URL にアクセスできる必要があります。同一リージョンの OSS バケットにイメージをアップロードし、署名付き URL を使用することを推奨します。
結果:
// Skill が multimodal_test コレクションを作成
// qwen3-vl-embedding マルチモーダルモデルを使用して埋め込みを自動生成
// 同一リージョンの OSS にイメージをアップロードし、署名付き URL を Milvus に渡します
コレクション作成完了:multimodal_test
フィールド:id、file_path、file_type、description、mm_value、embedding
AI Function:qwen3-vl-embedding
データ挿入完了:6 レコード(バナナ画像 3 件+猫画像 2 件+飛行機動画 1 件)
// テキストによる画像検索:「yellow banana」
結果:
top1:banana/img2 (distance=0.5005)
top2:banana/img3 (distance=0.4953)
top3:banana/img1 (distance=0.4882)
// テキストによる画像検索:「cute cat」
結果:
top1:cat2 (distance=0.5265)
top2:cat1 (distance=0.4893)クロスモーダル検索
イメージと動画を同時にインポートし、イメージ間検索およびイメージから動画への検索を含むクロスモーダル取得機能を検証します。
例となる Skill コマンド:
/alibabacloud-milvus-manage First import 2 files from the tiger_cat directory and airplane1.mp4 into the database,
then use any file from tiger_cat to search for similar product images and return the top 3. Then use an image to search for similar videos結果:
// イメージ間検索:cat1 イメージ URL を使用して類似イメージを検索
結果:
top1:cat1 (distance=0.9996)
top2:cat2 (distance=0.9476)
top3:banana/img1 (distance=0.7483)
// イメージから動画への検索:cat1 イメージ URL を使用+filter='file_type=="video"'
結果:
top1:airplane.mp4 (distance=0.7180)