共用方式為


Azure AI 視覺多模式內嵌技能

重要

此功能在補充使用規定下處於公開預覽狀態。 2024-05-01-Preview REST API 支援此功能。

Azure AI 視覺多模式內嵌技能會使用 Azure AI 視覺的多模式內嵌 API 來產生影像或文字輸入的內嵌。

只有位於支援 Azure AI 視覺多模式內嵌 API 區域的搜尋服務才支援技能。 檢閱 多模式內嵌的區域可用性。 您的數據會在部署模型的地理位置處理。

注意

此技能會繫結至 Azure AI 服務,並且每個索引子每天超過 20 個文件的交易需要可計費資源。 內建技能的執行會依現有的 Azure AI 服務預付型方案價格收費。

此外,影像擷取是由 Azure AI 搜尋服務計費

@odata.type

Microsoft.Skills.Vision.VectorizeSkill

資料限制

您可以在 Azure AI 視覺文件中,分別找到影像和文字的技能輸入限制。 如果您需要文字輸入的資料區塊處理,請考慮使用文字分割技能

技能參數

這些參數會區分大小寫。

輸入 描述
modelVersion (必要) 要傳遞至 Azure AI 視覺多模式以產生內嵌的模型版本。 請務必使用相同的 modelVersion 來產生儲存在指定索引欄位中的所有內嵌。 如需此模型版本支援的相關信息,請參閱 多模式內嵌。

技能輸入

輸入 描述
text 要向量化的輸入文字。 如果您使用資料區塊處理,來源可能是 /document/pages/*
image 複雜類型。 目前僅可搭配 "/document/normalized_images" 欄位使用,該欄位是由 Azure Blob 索引子在 imageAction 被設定為 none 以外的其他值時產生。
url 下載要向量化之影像的 URL。
queryString 下載要向量化之影像的 URL 查詢字串。 如果您將 URL 和 SAS 權杖儲存在個別路徑中,則很有用。

針對技能的單一執行個體,只能設定 textimageurl/queryString 其中之一。 如果您想要在相同技能集內同時向量化影像和文字,請在技能集定義中包含此技能的兩個執行個體,分別用於您想要使用的輸入類型。

技能輸出

輸出 描述
vector 輸入文字或影像的輸出內嵌浮點數陣列。

範例定義

針對文字輸入,請考慮具有下列欄位的記錄:

{
    "content": "Microsoft released Windows 10."
}

然後您的技能定義看起來可能會像這樣:

{ 
    "@odata.type": "#Microsoft.Skills.Vision.VectorizeSkill", 
    "context": "/document", 
    "modelVersion": "2023-04-15", 
    "inputs": [ 
        { 
            "name": "text", 
            "source": "/document/content" 
        } 
    ], 
    "outputs": [ 
        { 
            "name": "vector"
        } 
    ] 
} 

針對影像輸入,您的技能定義看起來可能會像這樣:

{
    "@odata.type": "#Microsoft.Skills.Vision.VectorizeSkill",
    "context": "/document/normalized_images/*",
    "modelVersion": "2023-04-15", 
    "inputs": [
        {
            "name": "image",
            "source": "/document/normalized_images/*"
        }
    ],
    "outputs": [
        {
            "name": "vector"
        }
    ]
}

如果您想要直接從 Blob 儲存體資料來源向量化影像,您的技能定義看起來可能會像這樣:

{
    "@odata.type": "#Microsoft.Skills.Vision.VectorizeSkill",
    "context": "/document",
    "modelVersion": "2023-04-15", 
    "inputs": [
        {
            "name": "url",
            "source": "/document/metadata_storage_path"
        },
        {
            "name": "queryString",
            "source": "/document/metadata_storage_sas_token"
        }
    ],
    "outputs": [
        {
            "name": "vector"
        }
    ]
}

範例輸出

針對指定的輸入文字,會產生向量化內嵌輸出。

{
  "vector": [
        0.018990106880664825,
        -0.0073809814639389515,
        .... 
        0.021276434883475304,
      ]
}

輸出位於記憶體中。 若要將此輸出傳送至搜尋索引中的欄位,您必須定義 outputFieldMapping,將向量化內嵌輸出 (這是陣列) 對應至向量欄位。 假設技能輸出位於文件的向量節點,且 content_vector 是搜尋索引中的欄位,索引子中的 outputFieldMapping 看起來應該會像這樣:

  "outputFieldMappings": [
    {
      "sourceFieldName": "/document/vector/*",
      "targetFieldName": "content_vector"
    }
  ]

若要將影像內嵌對應至索引,您必須使用索引投影功能。 indexProjections 的承載看起來可能會像這樣:

"indexProjections": {
    "selectors": [
        {
            "targetIndexName": "myTargetIndex",
            "parentKeyFieldName": "ParentKey",
            "sourceContext": "/document/normalized_images/*",
            "mappings": [
                {
                    "name": "content_vector",
                    "source": "/document/normalized_images/*/vector"
                }
            ]
        }
    ]
}

另請參閱