How to generate generate embeddings without DeploymentNotFound error?

Amitoj Singh 0 Reputation points
2024-09-10T21:11:50.6+00:00

Hello!

I am new to Azure OpenAI and trying to convert my OpenAI embedding function to Azure.

I provide the AzureOpenAI client instance with an API key, version, and Azure endpoint.

client = AzureOpenAI(
    api_key=api_key,
    api_version="2024-02-01",
    azure_endpoint=azure_endpoint,
)

Using this, I can successfully create completions, where deployment_name is a custom model that is deployed:

response = client.chat.completions.create(model=deployment_name, messages=messages)

Using the client, I create embeddings as such:

client.embeddings.create(input=text, model="text-embedding-3-large").data[0].embedding

This results in an error:
openai.NotFoundError: Error code: 404 - {'error': {'code': 'DeploymentNotFound', 'message': 'The API deployment for this resource does not exist. If you created the deployment within the last 5 minutes, please wait a moment and try again.'}}

Do I need to deploy a custom model to get this to run successfully as the completions are? I don't see this requirement in any documentation. Please help!

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,238 questions
{count} votes

1 answer

Sort by: Most helpful
  1. AshokPeddakotla-MSFT 34,616 Reputation points
    2024-09-11T06:13:53.2033333+00:00

    Amitoj Singh Greetings & Welcome to Microsoft Q&A forum!

    Do I need to deploy a custom model to get this to run successfully as the completions are? I don't see this requirement in any documentation.

    To answer your question, yes, you need deploy an embedding model. In your case it is text-embedding-3-large model.

    Please see Learn how to generate embeddings with Azure OpenAI and Explore Azure OpenAI Service embeddings and document search for more details.

    Do let me know if that helps or have any further queries.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.