Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use Azure OpenAI embedding model. #683

Open
xuhaoruins opened this issue Apr 2, 2024 · 1 comment
Open

Cannot use Azure OpenAI embedding model. #683

xuhaoruins opened this issue Apr 2, 2024 · 1 comment

Comments

@xuhaoruins
Copy link

I cannot use Azure OpenAI embedding model as:

const azureOpenaiLLM = new OpenAI({ model: "gpt-4", temperature: 0 });
const azureOpenaiEmbedding = new OpenAIEmbedding({ model: "text-embedding-ada-002", });
const serviceContext = serviceContextFromDefaults({ llm: azureOpenaiLLM, embedModel : azureOpenaiEmbedding });

looks like the value not pass into:
Stack trace:
Error: 400 The embeddings operation does not work with the specified model, gpt-35-turbo. Please choose different model and try again.

May I know how to use Azure OpenAI embedding model?

@marcusschiesser
Copy link
Collaborator

I assume you set the Azure env variables, see https://ts.llamaindex.ai/modules/llms/available_llms/azure#environment-variables?

Then I would try calling the embedding model directly first:

  const texts = ["hello", "world"];
  const embeddings = await azureOpenaiEmbedding.getTextEmbeddingsBatch(texts);
  console.log(`\nWe have ${embeddings.length} embeddings`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants