你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Azure OpenAI 向量器连接到部署到 Azure OpenAI 资源或 Azure AI Foundry 项目的嵌入模型,以在查询时生成嵌入内容。 数据在部署模型的地理位置进行处理。
尽管向量器在查询时使用,但在索引定义中指定它们,并通过矢量配置文件在向量字段上引用它们。 有关详细信息,请参阅 在搜索索引中配置向量器。
在 REST API 中调用 AzureOpenAIVectorizer Azure OpenAI 向量器。 使用最新的稳定版本的 索引 - 创建 (REST API) 或提供该功能的 Azure SDK 包。
Note
此向量器绑定到 Azure OpenAI,并按现有的 Azure OpenAI 标准版价格收费。
Prerequisites
Azure AI Foundry 模型资源或 Azure AI Foundry 项目中的 Azure OpenAI。
Azure OpenAI 资源必须具有 自定义子域,例如
https://<resourcename>.openai.azure.com。 如果在 Azure 门户中创建了资源,则此子域是在资源设置过程中自动生成的。Azure AI Foundry 项目应具有具有域的
cognitiveservices.azure.comAzure AI 服务终结点。 将 Azure OpenAI 嵌入模型部署到项目后,必须更改终结点以使用openai.azure.com域。 例如,将终结点从https://<resourcename>.cognitiveservices.azure.com更改为https://<resourcename>.openai.azure.com。 然后,可以将此更新的resourceUri终结点用于此向量器中的属性。
部署到资源或项目的 Azure OpenAI 嵌入模型。 有关支持的模型,请参阅下一部分。
Vectorizer 参数
参数区分大小写。
| 参数名称 | Description |
|---|---|
resourceUri |
模型提供程序的 URI。 此参数仅支持具有域的 openai.azure.com URL,例如 https://<resourcename>.openai.azure.com。 如果 Azure OpenAI 终结点具有具有域的 cognitiveservices.azure.com URL,例如https://<resourcename>.cognitiveservices.azure.com,必须为 Azure OpenAI 资源创建自定义子域openai.azure.com,并https://<resourcename>.openai.azure.com改用。 URL https://<resourcename>.azure-api.net 支持 Azure API 管理终结点。 API 管理终结点不支持共享专用链接。 |
apiKey |
用于访问模型的密钥。 如果你提供密钥,请将 authIdentity 留空。 如果同时设置 apiKey 和 authIdentity,则会在连接上使用 apiKey =。 |
deploymentId |
已部署的 Azure OpenAI 嵌入模型的名称。 模型应该是嵌入模型,例如 text-embedding-ada-002。 有关支持的模型,请参阅 Azure OpenAI 模型列表。 |
authIdentity |
搜索服务用于连接到 Azure OpenAI 的用户托管标识。 可以使用系统托管标识或用户托管标识。 若要使用系统托管标识,请保留并apiKey留authIdentity空。 会自动使用系统托管标识。 托管标识必须具有认知服务 OpenAI 用户权限才能将文本发送到 Azure OpenAI。 |
modelName |
(在 API 版本 2024-05-01-Preview 及更高版本中是必需的)。 部署在提供的 resourceUri 和 deploymentId 中的 Azure OpenAI 嵌入模型的名称。 目前,支持的值是 text-embedding-ada-002, text-embedding-3-large以及 text-embedding-3-small。 |
支持的矢量查询类型
Azure OpenAI 矢量器仅支持 text 矢量查询。
预期字段维度
使用 Azure OpenAI 矢量器配置的字段的预期字段维度取决于配置的 modelName。
modelName |
最小尺寸 | 最大尺寸 |
|---|---|---|
| text-embedding-ada-002 | 1536 | 1536 |
| text-embedding-3-large | 1 | 3072 |
| text-embedding-3-small | 1 | 1536 |
示例定义
"vectorizers": [
{
"name": "my-openai-vectorizer",
"kind": "azureOpenAI",
"azureOpenAIParameters": {
"resourceUri": "https://my-fake-azure-openai-resource.openai.azure.com",
"apiKey": "0000000000000000000000000000000000000",
"deploymentId": "my-ada-002-deployment",
"authIdentity": null,
"modelName": "text-embedding-ada-002",
},
}
]