You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, I want to thank you for creating RubyLLM, I’m particularly impressed with the clean code, design and documentation.
I’ve been exploring the embeddings functionality and noticed that there isn't a way to explicitly configure the dimensions of the embeddings generated as output.
For applications using pgvector or similar vector databases, this capability would allow developers to optimize their vector storage and query performance while maintaining consistency across all embeddings generated from the same model.
Models that generate embeddings allow you to configure the output dimension:
I’d like to propose adding support for configuring embedding dimensions, both globally and per-request.
This would allow users to:
Ensure consistent dimensionality across different embedding
Standardize embedding dimensions throughout an application, making vector operations more predictable
Simplify integration with external systems that may expect specific vector dimensions
The implementation could look something like:
# Global configurationRubyLLM.configuredo |config|
config.default_embedding_model="text-embedding-3-small"config.default_embedding_dimensions=1024end# Per-request configurationembedding=RubyLLM.embed("Ruby is a programmer's best friend",model: "text-embedding-3-small",dimensions: 512)
I would be happy to implement this feature myself. Please let me know if this aligns with your vision for the project and if you have any specific implementation preferences or considerations.
Again, thank you for this work, and I look forward to potentially contributing to this project!
The text was updated successfully, but these errors were encountered:
papgmez
changed the title
Add Support for Configuring Embedding Dimensions
Add support for configuring Embedding dimensions
Mar 19, 2025
Thanks for the kind words about RubyLLM! Your suggestion to add configurable embedding dimensions makes perfect sense - both the global and per-request implementation approach look good.
Feel free to open a PR with this feature. Just make sure to include tests verifying it works correctly with the underlying APIs.
First of all, I want to thank you for creating RubyLLM, I’m particularly impressed with the clean code, design and documentation.
I’ve been exploring the embeddings functionality and noticed that there isn't a way to explicitly configure the dimensions of the embeddings generated as output.
For applications using pgvector or similar vector databases, this capability would allow developers to optimize their vector storage and query performance while maintaining consistency across all embeddings generated from the same model.
Models that generate embeddings allow you to configure the output dimension:
I’d like to propose adding support for configuring embedding dimensions, both globally and per-request.
This would allow users to:
The implementation could look something like:
I would be happy to implement this feature myself. Please let me know if this aligns with your vision for the project and if you have any specific implementation preferences or considerations.
Again, thank you for this work, and I look forward to potentially contributing to this project!
The text was updated successfully, but these errors were encountered: