Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

SemanticCache vector index algorithm is hardcoded to FLAT; no way to configure HNSW

Abierto
#602 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

@omribz156 ya está trabajando en esto.

Desde el 25/5/2026.

  • #619 de @omribz156 — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
python, redis

Línea de trabajo

Comienza con SemanticCacheIndexSchema.from_params en redisvl/extensions/cache/llm/schema.py:115 e inspecciona el constructor de SemanticCache para rastrear cómo se pasan las configuraciones del índice durante la creación. Añade configuración en el momento de la construcción para el algoritmo vectorial y sus parámetros de HNSW, manteniendo FLAT como valor predeterminado; el trabajo estará terminado cuando las nuevas cachés puedan seleccionar HNSW sin crear el índice manualmente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

cache enhancement

Current behavior

SemanticCacheIndexSchema.from_params (redisvl/extensions/cache/llm/schema.py:115) hardcodes the vector field's algorithm to "flat":

{
    "name": CACHE_VECTOR_FIELD_NAME,
    "type": "vector",
    "attrs": {
        "dims": vector_dims,
        "datatype": dtype,
        "distance_metric": "cosine",
        "algorithm": "flat",
    },
},

There is no constructor argument on SemanticCache to override this. FLAT is exact KNN — fine to the low millions of entries, latency-degrading beyond that. For large multi-tenant deployments or per-tenant player-facing caches (10M–100M entries), HNSW is required. Today the only workaround is to bypass SemanticCache entirely and build the index manually.

Proposed API

SemanticCache(
    name="cache",
    redis_url=...,
    vector_index_config={
        "algorithm": "hnsw",          # or "flat" (default)
        "m": 16,
        "ef_construction": 200,
        "ef_runtime": 10,
    },
)

A simpler form taking just algorithm: Literal["flat", "hnsw"] = "flat" plus a default HNSW parameter preset would also be acceptable for a first cut.

Compatibility notes

The algorithm is fixed at index creation; existing FLAT caches cannot be hot-swapped to HNSW. Customers wanting to switch must build a new cache (new name), re-warm, and cut over — same migration shape as a schema change. This is acceptable as long as the option exists at construction time.

Notes

Surfaced while writing a scoped semantic caching architecture spec for customers running large-scale, multi-tenant deployments.

Lenguaje dominante
Python
Estrellas
431
Forks
107
Merge medio
5 d 17 h
PR fusionados (30 d)
16

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de redis/redis-vl-python

Todos los issues de redis/redis-vl-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.