Skip to content

GH-3540: Allow user-provided embeddings in VectorStore #3541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aniketg-21
Copy link

🚀 Motivation

Current VectorStore implementations (e.g., ChromaVectorStore) automatically generate embeddings from Document.content using the configured EmbeddingModel. However, more advanced use cases require greater flexibility:

  1. Precomputed embeddings: Embeddings may be generated externally, such as via batch pipelines or fine-tuned models.
  2. Embedding semantic intent: In some cases, embeddings should reflect a prompt, summary, or intent—not the raw content.
  3. Structured data: When storing structured formats (e.g., JSON), embedding the full raw structure often reduces semantic quality.

🔧 Enhancement

This PR introduces support for user-supplied embeddings, allowing applications to decouple document storage from semantic representation. This separation enables more accurate and intentional embedding strategies for search and retrieval.

  • If no embedding is provided, the default behavior—auto-generating embeddings from content—is preserved.
  • This change improves semantic search relevance without compromising the integrity or structure of stored documents.

✅ Backward Compatibility

Fully maintained. The default pipeline continues to auto-generate embeddings when none are explicitly provided.

🧪 Testing & Limitations

This feature has been tested with SimpleVectorStore. Other implementations (e.g., Pinecone, Milvus) were not tested due to environment constraints and may require further validation or adapter adjustments.

✅ Issue Closed

Closes #3540

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Custom User-Provided Embeddings in VectorStore add(...) Method
1 participant