[PR #153] [MERGED] [Fork] Batch embed by jwaltz #3217

Closed
opened 2026-02-22 18:33:18 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/153
Author: @timothycarambat
Created: 7/20/2023
Status: Merged
Merged: 7/20/2023
Merged by: @timothycarambat

Base: masterHead: batch-embed


📝 Commits (6)

  • e2b3b74 refactor: convert chunk embedding to one API call
  • 885d5e2 chore: lint
  • fe0eebb merge with master
  • 10717e3 fix chroma for batch and single vectorization of text
  • f7728e8 Fix LanceDB multi and single vectorization
  • f2d8ccc Fix pinecone for single and multiple embeddings

📊 Changes

4 files changed (+84 additions, -61 deletions)

View changed files

📝 server/utils/helpers/index.js (+17 -7)
📝 server/utils/vectorDbProviders/chroma/index.js (+20 -17)
📝 server/utils/vectorDbProviders/lance/index.js (+27 -23)
📝 server/utils/vectorDbProviders/pinecone/index.js (+20 -14)

📄 Description

Original Author: jwaltz

I was having really long embed times for a couple large .docx documents ingested through the /hotdir. One had 256 chunks and took many minutes to fully embed, sometimes never finishing at all.

I converted the embedChunk() method to accept a list of chunks instead of just one chunk, and make a single call to OpenAI's embedding API endpoint, which seems to have sped up the embed process dramatically. The refactored embedChunks() required some changes to its usage in addDocumentToNamespace() as well. I included these changes for the 3 vector db options at /server/utils/vectorDbProviders/[vectorDb]/index.js

Let me know what you think and if this is helpful. Again, apologies for my editor's lsp changing some of the method signatures and line-length formatting, hope it is ok.

Had to modify this code as it would break the application since we do both multiple embeds and singular text embeds so each vector database needs to have this interface and support it since during chat mode we manually embed the query.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/153 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 7/20/2023 **Status:** ✅ Merged **Merged:** 7/20/2023 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `batch-embed` --- ### 📝 Commits (6) - [`e2b3b74`](https://github.com/Mintplex-Labs/anything-llm/commit/e2b3b7494a896ff6e8a31de223a966caedb3e474) refactor: convert chunk embedding to one API call - [`885d5e2`](https://github.com/Mintplex-Labs/anything-llm/commit/885d5e2943bb60326442206207e7ff8f4c27e889) chore: lint - [`fe0eebb`](https://github.com/Mintplex-Labs/anything-llm/commit/fe0eebb6dc5ab0593945879fb7e535cc5efaf585) merge with master - [`10717e3`](https://github.com/Mintplex-Labs/anything-llm/commit/10717e3dffa8244e961f86052d8666405b086a96) fix chroma for batch and single vectorization of text - [`f7728e8`](https://github.com/Mintplex-Labs/anything-llm/commit/f7728e896e72964a82e6c5e29cf86d3f33345b09) Fix LanceDB multi and single vectorization - [`f2d8ccc`](https://github.com/Mintplex-Labs/anything-llm/commit/f2d8cccb3d16040ce63147cd4bd419d4ace26c16) Fix pinecone for single and multiple embeddings ### 📊 Changes **4 files changed** (+84 additions, -61 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/helpers/index.js` (+17 -7) 📝 `server/utils/vectorDbProviders/chroma/index.js` (+20 -17) 📝 `server/utils/vectorDbProviders/lance/index.js` (+27 -23) 📝 `server/utils/vectorDbProviders/pinecone/index.js` (+20 -14) </details> ### 📄 Description Original Author: [jwaltz](https://github.com/jwaltz) > I was having really long embed times for a couple large .docx documents ingested through the /hotdir. One had 256 chunks and took many minutes to fully embed, sometimes never finishing at all. > > I converted the embedChunk() method to accept a list of chunks instead of just one chunk, and make a single call to OpenAI's embedding API endpoint, which seems to have sped up the embed process dramatically. The refactored embedChunks() required some changes to its usage in addDocumentToNamespace() as well. I included these changes for the 3 vector db options at /server/utils/vectorDbProviders/[vectorDb]/index.js > > Let me know what you think and if this is helpful. Again, apologies for my editor's lsp changing some of the method signatures and line-length formatting, hope it is ok. Had to modify this code as it would break the application since we do both multiple embeds and singular text embeds so each vector database needs to have this interface and support it since during chat mode we manually embed the query. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-22 18:33:18 -05:00
yindo closed this issue 2026-02-22 18:33:18 -05:00
yindo changed title from [PR #153] [MERGED] [Fork] Batch embed by jwaltz to [PR #153] [MERGED] [Fork] Batch embed by jwaltz 2026-06-05 14:53:53 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#3217