[PR #1428] [MERGED] Do not go through LLM to embed when embedding documents #3680

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

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/1428
Author: @timothycarambat
Created: 5/16/2024
Status: Merged
Merged: 5/16/2024
Merged by: @timothycarambat

Base: masterHead: 1420-skip-llm-for-embedding


📝 Commits (1)

  • cc281c4 Do not go through LLM to embed when embedding documents

📊 Changes

9 files changed (+34 additions, -66 deletions)

View changed files

📝 server/utils/helpers/index.js (+2 -2)
📝 server/utils/vectorDbProviders/astra/index.js (+4 -8)
📝 server/utils/vectorDbProviders/chroma/index.js (+4 -8)
📝 server/utils/vectorDbProviders/lance/index.js (+4 -8)
📝 server/utils/vectorDbProviders/milvus/index.js (+4 -8)
📝 server/utils/vectorDbProviders/pinecone/index.js (+4 -8)
📝 server/utils/vectorDbProviders/qdrant/index.js (+4 -8)
📝 server/utils/vectorDbProviders/weaviate/index.js (+4 -8)
📝 server/utils/vectorDbProviders/zilliz/index.js (+4 -8)

📄 Description

Pull Request Type

  • feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #1420

What is in this change?

From legacy code we used to go through the LLM class to reach the embedTextInput and embedChunks functions. This does not make sense to go though when calling addDocuments in any vector db since instantiation of an LLM can have API_KEY requirements and makes no sense, since the LLM is not even called during this operation.

We move now to just grabbing the embedder engine alone and do the query directly on the class instead of via a passthrough on the LLM provider. It can still be accessed through the LLM class and needs to be for prompt embedding, but this eliminate the need on uploading only to have a valid LLM key.

Additional Information

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 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/1428 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 5/16/2024 **Status:** ✅ Merged **Merged:** 5/16/2024 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `1420-skip-llm-for-embedding` --- ### 📝 Commits (1) - [`cc281c4`](https://github.com/Mintplex-Labs/anything-llm/commit/cc281c40a00605301635052a3fc5efa39fb5cf09) Do not go through LLM to embed when embedding documents ### 📊 Changes **9 files changed** (+34 additions, -66 deletions) <details> <summary>View changed files</summary> 📝 `server/utils/helpers/index.js` (+2 -2) 📝 `server/utils/vectorDbProviders/astra/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/chroma/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/lance/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/milvus/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/pinecone/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/qdrant/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/weaviate/index.js` (+4 -8) 📝 `server/utils/vectorDbProviders/zilliz/index.js` (+4 -8) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat - [x] 🐛 fix - [ ] ♻️ refactor - [ ] 💄 style - [x] 🔨 chore - [ ] 📝 docs ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> resolves #1420 ### What is in this change? From legacy code we used to go through the LLM class to reach the `embedTextInput` and `embedChunks` functions. This does not make sense to go though when calling `addDocuments` in any vector db since instantiation of an LLM can have API_KEY requirements and makes no sense, since the LLM is not even called during this operation. We move now to just grabbing the embedder engine alone and do the query directly on the class instead of via a passthrough on the LLM provider. It _can still be accessed_ through the LLM class and needs to be for prompt embedding, but this eliminate the need on uploading only to have a valid LLM key. ### Additional Information <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [ ] I ran `yarn lint` from the root of the repo & committed changes - [ ] Relevant documentation has been updated - [ ] I have tested my code functionality - [ ] Docker build succeeds locally --- <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:34:16 -05:00
yindo closed this issue 2026-02-22 18:34:16 -05:00
yindo changed title from [PR #1428] Do not go through LLM to embed when embedding documents to [PR #1428] [MERGED] Do not go through LLM to embed when embedding documents 2026-06-05 15:14:39 -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#3680