feat(vector-quantization): add RaBitQ support for VectorChord#386
Open
qdrddr wants to merge 2 commits intovectorize-io:mainfrom
Open
feat(vector-quantization): add RaBitQ support for VectorChord#386qdrddr wants to merge 2 commits intovectorize-io:mainfrom
qdrddr wants to merge 2 commits intovectorize-io:mainfrom
Conversation
Add environment variables and validation for vector quantization. Update alembic migrations to handle dynamic embedding dimensions and a new migration that converts embeddings to rabitq8/rabitq4 types. Provide helper to quantize embeddings on insert and query. Pass quantization flags through memory engine and extension context. Add docker‑compose file reference and ignore it in .gitignore. Include comprehensive tests for config, helpers and migration. Document quantization options, trade‑offs and usage examples.
nicoloboschi
requested changes
Feb 18, 2026
| return f'"{schema}".' if schema else "" | ||
|
|
||
|
|
||
| def upgrade() -> None: |
Collaborator
There was a problem hiding this comment.
this new file is not needed - check the migration we do at api startup
| text_search_ext = _detect_text_search_extension() | ||
|
|
||
| # Read embedding dimension from environment, defaulting to 384 | ||
| embedding_dimension = int(os.getenv("DEFAULT_EMBEDDING_DIMENSION", "384")) |
Collaborator
There was a problem hiding this comment.
why?
- this env is not using Hindsight config convention
- why we need it? it just adds confusion - just let Hindsight handles the correct dimension from the configured embedding model
| if embedding_str: | ||
| embedding_expr = quantize_embedding(eval(embedding_str), config.vector_quantization_type) | ||
| else: | ||
| embedding_expr = "NULL" |
Collaborator
There was a problem hiding this comment.
we should raise exception here, something went really wrong
| from ..embeddings import quantize_embedding | ||
| config = get_config() | ||
| if embedding_str: | ||
| embedding_expr = quantize_embedding(eval(embedding_str), config.vector_quantization_type) |
| if embedding_str: | ||
| embedding_expr = quantize_embedding(eval(embedding_str), config.vector_quantization_type) | ||
| else: | ||
| embedding_expr = "NULL" |
Collaborator
There was a problem hiding this comment.
we should raise exception here, something went really wrong
| from .tags import build_tags_where_clause_simple | ||
|
|
||
| # Build vector reference with optional quantization | ||
| config = get_config() |
Collaborator
There was a problem hiding this comment.
use quantize_embedding
| # Get config for quantization settings | ||
| config = get_config() | ||
| # Build vector reference with optional quantization | ||
| if config.vector_quantization_enabled: |
| # Get config for quantization settings | ||
| config = get_config() | ||
| # Build vector reference with optional quantization | ||
| if config.vector_quantization_enabled: |
| # Convert embedding to string for asyncpg vector type and apply quantization if enabled | ||
| from .embeddings import quantize_embedding | ||
| config = get_config() | ||
| embedding_expr = quantize_embedding(embedding[0], config.vector_quantization_type) if embedding else None |
| otel_deployment_environment: str | ||
|
|
||
| # Vector quantization (RaBitQ for VectorChord) | ||
| vector_quantization_enabled: bool = static(DEFAULT_VECTOR_QUANTIZATION_ENABLED) |
Collaborator
There was a problem hiding this comment.
since this is specifically for vchord, it should be vector_extension_vchord_quantization_enabled and vector_extension_vchord_quantization_type
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add environment variables and validation for vector quantization. Update alembic migrations to handle dynamic embedding dimensions and a new migration that converts embeddings to rabitq8/rabitq4 types. Provide helper to quantize embeddings on insert and query. Pass quantization flags through memory engine and extension context. Add docker‑compose file reference and ignore it in .gitignore. Include comprehensive tests for config, helpers and migration. Document quantization options, trade‑offs and usage examples.
#385