[PR #24] [CLOSED] refactor: convert chunk embedding to one API call #3176

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

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/24
Author: @jwaltz
Created: 6/10/2023
Status: Closed

Base: masterHead: batch-embed


📝 Commits (2)

  • e2b3b74 refactor: convert chunk embedding to one API call
  • 885d5e2 chore: lint

📊 Changes

3 files changed (+61 additions, -55 deletions)

View changed files

📝 server/utils/vectorDbProviders/chroma/index.js (+15 -15)
📝 server/utils/vectorDbProviders/lance/index.js (+30 -27)
📝 server/utils/vectorDbProviders/pinecone/index.js (+16 -13)

📄 Description

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.


🔄 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/24 **Author:** [@jwaltz](https://github.com/jwaltz) **Created:** 6/10/2023 **Status:** ❌ Closed **Base:** `master` ← **Head:** `batch-embed` --- ### 📝 Commits (2) - [`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 ### 📊 Changes **3 files changed** (+61 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/vectorDbProviders/chroma/index.js` (+15 -15) 📝 `server/utils/vectorDbProviders/lance/index.js` (+30 -27) 📝 `server/utils/vectorDbProviders/pinecone/index.js` (+16 -13) </details> ### 📄 Description 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. --- <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:12 -05:00
yindo closed this issue 2026-02-22 18:33:12 -05: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#3176