When I use embeddings with Azure OpenAI I am getting 404 (resource not found):
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:
"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.
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:
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.
Check your Deployment Id, if 'ada2' is correct. You can sure, verify by sending a GET request to the URL:
https://AzureOpenAIExperiment.openai.azure.com/openai/deployments?api-version=2023-05-15
After, include the ID in your URL
https://AzureOpenAIExperiment.openai.azure.com/openai/deployments/{{ID}}/embeddings?api-version=2023-05-15
My test
My ID = text-embedding-ada-002
https://estudoopenai.openai.azure.com/openai/deployments/text-embedding-ada-002/embeddings?api-version=2023-05-15
{
"input":"test"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With