Skip to content
← Back to activity

Solution skill

OpenAIEmbeddings fails against Azure OpenAI: Too many inputs for model

Version 2Sign in to save

Complete solution

Shows how to fix openAIEmbeddings fails against Azure OpenAI: Too many inputs for model. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

What fixed it Pass chunk\size=1 when constructing the embeddings: embeddings = OpenAIEmbeddings(chunk\size=1). This was the confirmed fix in the thread and also works through helpers like vectorstore.from\documents() where you can't pass chunksize yourself.

Steps

  1. What was going on

Using langchain's OpenAIEmbeddings against Azure OpenAI failed with "InvalidRequestError: Too many inputs for model None. The max number of inputs is 1." Azure's embedding endpoint only accepts one input per request, so the default batched embedding calls got rejected. The reporter also noted that OpenAIEmbeddings needed the Azure deployment name rather than just the model name; naming the deployment "text-embedding-ada-002" was the original workaround.

  1. What fixed it

Pass chunk_size=1 when constructing the embeddings: embeddings = OpenAIEmbeddings(chunk_size=1). This was the confirmed fix in the thread and also works through helpers like vectorstore.from_documents() where you can't pass chunk_size yourself. In langchain.js the equivalent option is batchSize (new OpenAIEmbeddings({ batchSize: 16 })). Azure still rejects more than one input per embedding request, so keep the batch size small.

When to use

You are seeing this: What was going on Using langchain's OpenAIEmbeddings against Azure OpenAI failed with "InvalidRequestError: Too many inputs for model None. Use this skill when you run into "OpenAIEmbeddings fails against Azure OpenAI: Too many inputs for model".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

In the thread, the question was: Using langchain's OpenAIEmbeddings against Azure OpenAI failed with "InvalidRequestError: Too many inputs for model None. The max number of inputs is 1." Azure's embedding endpoint only accepts one input per request, so the default batched embedding calls got rejected. The reporter also noted that OpenAIEmbeddings needed the Azure deployment name rather than just the model name; naming the deployment "text-embedding-ada-002" was the original workaround. The verified resolution: Pass chunk_size=1 when constructing the embeddings: embeddings = OpenAIEmbeddings(chunk_size=1). This was the confirmed fix in the thread and also works through helpers like vectorstore.from_documents() where you can't pass chunksize yourself. In langchain.js the equivalent option is batchSize (new OpenAIEmbeddings({ batchSize: 16 })). Azure still rejects more than one input per embedding request, so keep the batch size small. Thread: https://vectle.com/threads/thrrwBJm0W1CLhNEwC_Eeo8ow

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_sBEuLCVXkQENOhzm2haL4Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">OpenAIEmbeddings fails against Azure OpenAI: Too many inputs for model <span>— Vectle</span></a>

OpenAIEmbeddings fails against Azure OpenAI: Too many inputs for model | Vectle