Skip to content

Conversation

@abrookins
Copy link
Collaborator

@abrookins abrookins commented Jan 23, 2026

Summary

Adds RedisVL integration, providing an escape hatch for advanced vector search operations.

Changes

  • Add redisvl as a dependency
  • Add aredis_om/redisvl.py module with:
    • to_redisvl_schema(model_cls) - Convert OM model to RedisVL IndexSchema
    • get_redisvl_index(model_cls) - Get ready-to-use RedisVL SearchIndex
  • Supports all OM field types: text, tag, numeric, vector
  • Supports FLAT and HNSW vector algorithms with all parameters

Usage

from aredis_om import JsonModel, Field, VectorFieldOptions
from aredis_om.redisvl import to_redisvl_schema, get_redisvl_index
from redisvl.query import VectorQuery

class Document(JsonModel, index=True):
    title: str = Field(index=True)
    embedding: list[float] = Field(
        vector_options=VectorFieldOptions.hnsw(
            type=VectorFieldOptions.TYPE.FLOAT32,
            dimension=768,
            distance_metric=VectorFieldOptions.DISTANCE_METRIC.COSINE,
        )
    )

# Get RedisVL index for advanced operations
index = get_redisvl_index(Document)

# Use RedisVL's advanced query features
results = await index.query(VectorQuery(
    vector=query_embedding,
    vector_field_name="embedding",
    num_results=10,
))

Why

This is the first step toward integrating RedisVL as the underlying query engine for Redis OM (see #790). It provides users immediate access to RedisVL's advanced features without changing OM internals:

  • VectorQuery with hybrid policies (BATCHES, ADHOC_BF)
  • VectorRangeQuery for epsilon-based searches
  • Advanced filter expressions
  • EF_RUNTIME tuning for HNSW indexes

Refs #790

- Add redisvl as optional dependency (pip install redis-om[redisvl])
- Add to_redisvl_schema() to convert OM models to RedisVL IndexSchema
- Add get_redisvl_index() to get ready-to-use SearchIndex
- Supports all OM field types: text, tag, numeric, vector
- Supports FLAT and HNSW vector algorithms with all parameters

Refs #790
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.

2 participants