コレクションに Function を追加 (V2)
この操作は、既存のコレクションのスキーマに function を追加します。
POST/v2/vectordb/collections/add_function
https://${CLUSTER_ENDPOINT}
📘ノート
${CLUSTER_ENDPOINT}を、あなたのZilliz Cloudクラスターのエンドポイントに置き換える必要があります。- エンドポイントを取得するには、Describe Cluster V2 APIを使用してレスポンスから値を抽出してください。
shell
export CLUSTER_ENDPOINT=""
パラメータ
Authorizationstringheader必要
認証トークンは、適切な権限を持つ API key または username:password のようにコロンで連結した username と password の組み合わせである必要があります。project endpoint を使用している場合は、十分な権限を持つ有効な API key のみ使用できます。
値の例: Bearer {{TOKEN}}
リクエスト・ボディapplication/json
dbNamestring
データベースの名前。
collectionNamestring必要
コレクションの名前。
functionobject必要
function スキーマオブジェクト。
namestring必要
作成する function の名前。
descriptionstring
作成する function の説明。
typestring必要
作成する function のタイプ。
inputFieldNamesarray必要
作成する function の入力フィールド名。
[]inputFieldNamesstring
フィールド名。
outputFieldNamesarray必要
作成する function の出力フィールド名。
[]outputFieldNamesstring
フィールド名。
paramsobject
現在の function に固有の構成パラメータ。function type が BM25 に設定されている場合、パラメータは不要です。TEXTEMBEDDING または RERANK の function に適用可能なパラメータについては、Embedding Functions および Reranking Functions を参照してください。
bash
export TOKEN="db_admin:xxxxxxxxxxxxx"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/collections/add_function" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Request-Timeout: 5" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "my_collection",
"function": {
"name": "bm25_fn",
"type": "BM25",
"inputFieldNames": [
"text"
],
"outputFieldNames": [
"sparse"
]
}
}'
レスポンス200 OK - application/json
なし
codeinteger
レスポンスコード。
dataobject
エラーメッセージを返します。
codeinteger
レスポンスコード。
messagestring
エラーメッセージ。
Successjson
{
"code": 0,
"data": {}
}