feat: support configurable embedding dimensions via VECTOR_STORE_DIMENSIONS#469
feat: support configurable embedding dimensions via VECTOR_STORE_DIMENSIONS#469TreyDong wants to merge 1 commit intoplastic-labs:mainfrom
Conversation
…NSIONS Replace hardcoded 1536 with settings.VECTOR_STORE.DIMENSIONS in: - embedding_client.py: 3 Gemini embed_content calls - models.py: 2 Vector() columns (MessageEmbedding, Document) The VECTOR_STORE_DIMENSIONS config field already existed but was not being used. This change wires it up, allowing users to configure embedding dimensions via the VECTOR_STORE_DIMENSIONS environment variable (e.g., 1024 for BGE-M3) instead of being locked to 1536. Backwards compatible: default remains 1536 when env var is unset.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe changes replace hardcoded embedding dimension values of Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This would require additional changes to the alembic migrations and models.py file to support storing different sized embeddings. Please also update the alembic migrations and sqlalchemy files accordingly |
Summary
Currently
embedding_client.pyandmodels.pyhardcode1536as the embedding dimension. This prevents using embedding providers with different dimensions (e.g., BGE-M3 at 1024 dimensions).Changes
Replace hardcoded
1536withsettings.VECTOR_STORE.DIMENSIONSin:Gemini embed_contentcalls (lines ~85, ~119, ~255)Vector()columns —MessageEmbedding.embeddingandDocument.embedding— and addfrom .config import settingsMotivation
The
VECTOR_STORE_DIMENSIONSconfig field already existed insrc/config.pybut was not being used inembedding_client.pyormodels.py. This change wires it up, allowing users to configure embedding dimensions via theVECTOR_STORE_DIMENSIONSenvironment variable instead of being locked to 1536.This is particularly useful for embedding providers like BGE-M3 (1024 dimensions).
Backwards Compatibility
Default remains
1536when theVECTOR_STORE_DIMENSIONSenv var is unset.Issue
Closes #463
Summary by CodeRabbit