Using Embeddings API in Azure OpenAI

**题意:**当我在 Azure OpenAI 中使用嵌入功能时,我遇到了 404 错误(资源未找到)

问题背景:

When I use embeddings with Azure OpenAI I am getting 404 (resource not found):

当我在 Azure OpenAI 中使用嵌入功能时,我遇到了 404 错误(资源未找到)

cs 复制代码
    EmbeddingsOptions embdOptions = new EmbeddingsOptions(text);
    Azure.AI.OpenAI.Embeddings response = Task.Run(() => mOpenAiClient.GetEmbeddingsAsync(mWebSvc.AzureOpenAI.DeploymentID, embdOptions)).Result;

The text is the input text to be used to create the vector. Also, mWebSvc.AzureOpenAI.DeploymentID is a Deployment ID or Deployment Name, which is "ada2" - this is how I named the text-embedding-ada-002 model. Also, while I created mOpenAiClient I used the URL:

该文本是用于创建向量的输入文本。同时,mWebSvc.AzureOpenAI.DeploymentID 是一个部署ID或部署名称,这里是 "ada2"------这是我给text-embedding-ada-002模型命名的名称。另外,在创建mOpenAiClient时,我使用了以下URL:

cs 复制代码
"https://AzureOpenAIExperiment.openai.azure.com/openai/deployments/ada2/embeddings?api-version=2023-05-15"

Any ideas? Microsoft is quite silent on these things and no documentation is provided in Azure OpenAI part of Azure SDK.

有什么想法吗?微软在这些事情上相当沉默,Azure SDK的Azure OpenAI部分也没有提供任何文档。

问题解决:

Apparently, the URL that I used before, although correct for normal HttpClient calls is not what Azure Open AI API is expecting. It expects this:

显然,我之前使用的URL虽然对于正常的HttpClient调用是正确的,但并不是Azure OpenAI API所期望的。它期望的是这样的:

cs 复制代码
https://{resourceName}.openai.azure.com

Where {resourceName} is a placeholder - it is the name of the resource you created on Azure. The Type Of Resource is: "Azure OpenAI". This is the resource that you deployed the model (in my case text-embedding-ada-002 that I named "ada2". This "ada2" goes as a parameter into GetEmbeddingsAsync function.

其中{resourceName}是一个占位符,它是你在Azure上创建的资源的名称。资源类型是:"Azure OpenAI"。这是你部署模型的资源(在我的情况下,我命名为"ada2"的text-embedding-ada-002模型)。这个"ada2"作为参数传递给GetEmbeddingsAsync函数。

相关推荐
笨蛋©42 分钟前
[实战] 制造业质检图纸数字化方案:从扫描件到自动化FAI/PPAP报表生成
ai·cad·质量管理·制造业·图纸识别
北京理工大学软件工程2 小时前
C#111
开发语言·c#
catoop2 小时前
大模型评测运营体系:从 “感觉不错“ 到 “数据驱动“
ai
Agent产品评测局2 小时前
制造业生产调度自动化落地,完整步骤与避坑指南:2026企业级智能体选型与实战全景
运维·人工智能·ai·chatgpt·自动化
engchina2 小时前
Docker Compose で PowerRAG を WSL2 Ubuntu に入れてみた
ai·powerrag
Elastic 中国社区官方博客3 小时前
Elasticsearch:智能搜索 - AI builder 及 skills
大数据·人工智能·elasticsearch·搜索引擎·ai·信息可视化·全文检索
Huang2601083 小时前
Twitter 用户信息 API 集成指南
ai
Jiangxl~3 小时前
IP数据云如何为不同行业提供精准IP查询与风险防控解决方案?
网络·网络协议·tcp/ip·算法·ai·ip·安全架构
程序员鱼皮4 小时前
DeepSeek V4 + GPT-5.5 一手实战,结果很意外!附 Codex 保姆级项目教程
ai·程序员·编程·ai编程·deepseek
熊猫钓鱼>_>4 小时前
AR游戏的“轻”与“深”:当智能体接管眼镜,游戏逻辑正在发生什么变化?
人工智能·游戏·ai·ar·vr·game·智能体