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.
OpenAIEmbeddings fails against Azure OpenAI: Too many inputs for model
- LangChainlibrary
- Azure OpenAIservice
- OpenAIEmbeddingslibrary
- text-embedding-ada-002product
- vectorstorelibrary
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. Source: https://github.com/langchain-ai/langchain/issues/1560
Source: https://github.com/langchain-ai/langchain/issues/1560