From ec16be002fa89763d1f6518f7535bbd3324b6fff Mon Sep 17 00:00:00 2001 From: Lilith Date: Tue, 13 Jan 2026 09:23:28 -0800 Subject: [PATCH] =?UTF-8?q?feat(@ml/redis-vector-search-py):=20=E2=9C=A8?= =?UTF-8?q?=20Add=20Redis=20vector=20search=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extracted from rag-retrieval as reusable package: - Redis-backed vector storage with RediSearch HNSW indexing - Configurable schema (index name, prefix, field names) - SemanticSearch for document indexing and similarity search - HttpEmbeddingProvider for embedding generation - Renamed from knowledge-py to accurately reflect Redis-specific impl Co-Authored-By: Claude Opus 4.5 --- ...CH_SCHEMA.md => REDIS_VECTOR_SEARCH_SCHEMA.md | 6 +++--- model-boss-py | 2 +- .../README.md | 16 ++++++++-------- .../pyproject.toml | 6 +++--- .../src/redis_vector_search}/__init__.py | 14 +++++++------- .../src/redis_vector_search}/embeddings.py | 2 +- .../src/redis_vector_search}/py.typed | 0 .../src/redis_vector_search}/redis_client.py | 0 .../src/redis_vector_search}/schema.py | 0 .../src/redis_vector_search}/semantic.py | 6 +++--- .../src/redis_vector_search}/vector_store.py | 2 +- redis-vector-search-py/tests/__init__.py | 1 + .../tests/test_semantic.py | 0 vector-search-py/tests/__init__.py | 1 - 14 files changed, 28 insertions(+), 28 deletions(-) rename VECTOR_SEARCH_SCHEMA.md => REDIS_VECTOR_SEARCH_SCHEMA.md (93%) rename {vector-search-py => redis-vector-search-py}/README.md (87%) rename {vector-search-py => redis-vector-search-py}/pyproject.toml (90%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/__init__.py (73%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/embeddings.py (98%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/py.typed (100%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/redis_client.py (100%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/schema.py (100%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/semantic.py (97%) rename {vector-search-py/src/vector_search => redis-vector-search-py/src/redis_vector_search}/vector_store.py (99%) create mode 100644 redis-vector-search-py/tests/__init__.py rename {vector-search-py => redis-vector-search-py}/tests/test_semantic.py (100%) delete mode 100644 vector-search-py/tests/__init__.py diff --git a/VECTOR_SEARCH_SCHEMA.md b/REDIS_VECTOR_SEARCH_SCHEMA.md similarity index 93% rename from VECTOR_SEARCH_SCHEMA.md rename to REDIS_VECTOR_SEARCH_SCHEMA.md index 7930e85..68bdb53 100644 --- a/VECTOR_SEARCH_SCHEMA.md +++ b/REDIS_VECTOR_SEARCH_SCHEMA.md @@ -1,6 +1,6 @@ -# Vector Search Redis Schema +# Redis Vector Search Schema -This document defines the Redis schema used by `lilith-vector-search` (Python). +This document defines the Redis schema used by `lilith-redis-vector-search` (Python). ## Schema Philosophy @@ -30,7 +30,7 @@ This document defines the Redis schema used by `lilith-vector-search` (Python). Applications can override all defaults: ```python -from vector_search import VectorStore, VectorIndexConfig, FieldNames +from redis_vector_search import VectorStore, VectorIndexConfig, FieldNames config = VectorIndexConfig( name="myapp:idx:docs", diff --git a/model-boss-py b/model-boss-py index 91722ce..ce019c7 160000 --- a/model-boss-py +++ b/model-boss-py @@ -1 +1 @@ -Subproject commit 91722cedcbf74fe03586081e7e20f28ea9364f30 +Subproject commit ce019c78e7c63ae2ebc68276e20a8effac37a721 diff --git a/vector-search-py/README.md b/redis-vector-search-py/README.md similarity index 87% rename from vector-search-py/README.md rename to redis-vector-search-py/README.md index 8c3acc8..41dad70 100644 --- a/vector-search-py/README.md +++ b/redis-vector-search-py/README.md @@ -1,17 +1,17 @@ -# lilith-vector-search +# lilith-redis-vector-search -Vector search and semantic retrieval using Redis with HNSW indexing. +Redis-backed vector search using RediSearch HNSW indexing. ## Installation ```bash -pip install lilith-vector-search +pip install lilith-redis-vector-search ``` ## Quick Start ```python -from vector_search import ( +from redis_vector_search import ( SemanticSearch, VectorStore, VectorIndexConfig, @@ -57,7 +57,7 @@ async def main(): Applications can configure their own schema for independence: ```python -from vector_search import VectorStore, VectorIndexConfig, FieldNames +from redis_vector_search import VectorStore, VectorIndexConfig, FieldNames config = VectorIndexConfig( name="myapp:idx:docs", @@ -75,7 +75,7 @@ vector_store = VectorStore(redis, config) ## Features -- **Vector Search**: HNSW-based similarity search via Redis +- **HNSW Vector Search**: Fast approximate nearest neighbor via RediSearch - **Configurable Schema**: Applications define their own index/prefix/fields - **Chunking**: Automatic document chunking with configurable overlap - **Batch Operations**: Efficient batch indexing with Redis pipelines @@ -127,7 +127,7 @@ embedder = HttpEmbeddingProvider( ) # Mock provider (testing) -from vector_search.embeddings import MockEmbeddingProvider +from redis_vector_search.embeddings import MockEmbeddingProvider embedder = MockEmbeddingProvider(dimensions=384) ``` @@ -141,7 +141,7 @@ Environment variables: ## Schema Documentation -See `@packages/@ml/VECTOR_SEARCH_SCHEMA.md` for detailed schema documentation. +See `@packages/@ml/REDIS_VECTOR_SEARCH_SCHEMA.md` for detailed schema documentation. ## Development diff --git a/vector-search-py/pyproject.toml b/redis-vector-search-py/pyproject.toml similarity index 90% rename from vector-search-py/pyproject.toml rename to redis-vector-search-py/pyproject.toml index 679eb15..5d3d322 100644 --- a/vector-search-py/pyproject.toml +++ b/redis-vector-search-py/pyproject.toml @@ -3,9 +3,9 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "lilith-vector-search" +name = "lilith-redis-vector-search" version = "0.1.0" -description = "Vector search and semantic retrieval using Redis with HNSW indexing" +description = "Redis-backed vector search using RediSearch HNSW indexing" requires-python = ">=3.11" license = "MIT" authors = [{ name = "Lilith", email = "lilith@nasty.sh" }] @@ -37,7 +37,7 @@ dev = [ ] [tool.hatch.build.targets.wheel] -packages = ["src/vector_search"] +packages = ["src/redis_vector_search"] [tool.hatch.build.targets.sdist] include = [ diff --git a/vector-search-py/src/vector_search/__init__.py b/redis-vector-search-py/src/redis_vector_search/__init__.py similarity index 73% rename from vector-search-py/src/vector_search/__init__.py rename to redis-vector-search-py/src/redis_vector_search/__init__.py index dc728ee..2475a7a 100644 --- a/vector-search-py/src/vector_search/__init__.py +++ b/redis-vector-search-py/src/redis_vector_search/__init__.py @@ -1,11 +1,11 @@ """ -Vector Search - Redis-backed semantic similarity search. +Redis Vector Search - Semantic similarity search using RediSearch. Provides vector storage and search using Redis with HNSW indexing. Configurable schema for application independence. Usage: - from vector_search import SemanticSearch, VectorStore, get_redis_client + from redis_vector_search import SemanticSearch, VectorStore, get_redis_client # Create components redis = await get_redis_client() @@ -19,25 +19,25 @@ Usage: results = await search.search("query text") """ -from vector_search.schema import ( +from redis_vector_search.schema import ( SCHEMA_VERSION, DEFAULT_INDEX_NAME, DEFAULT_KEY_PREFIX, DEFAULT_DIMENSIONS, DEFAULT_DISTANCE_METRIC, ) -from vector_search.redis_client import ( +from redis_vector_search.redis_client import ( get_redis_client, close_redis_client, is_redis_ready, ) -from vector_search.vector_store import VectorStore, VectorIndexConfig, FieldNames, TextChunk -from vector_search.semantic import ( +from redis_vector_search.vector_store import VectorStore, VectorIndexConfig, FieldNames, TextChunk +from redis_vector_search.semantic import ( SemanticSearch, SemanticSearchResult, ChunkingOptions, ) -from vector_search.embeddings import EmbeddingProvider, HttpEmbeddingProvider +from redis_vector_search.embeddings import EmbeddingProvider, HttpEmbeddingProvider __all__ = [ # Schema defaults (applications can use or override) diff --git a/vector-search-py/src/vector_search/embeddings.py b/redis-vector-search-py/src/redis_vector_search/embeddings.py similarity index 98% rename from vector-search-py/src/vector_search/embeddings.py rename to redis-vector-search-py/src/redis_vector_search/embeddings.py index 78d82b4..360956b 100644 --- a/vector-search-py/src/vector_search/embeddings.py +++ b/redis-vector-search-py/src/redis_vector_search/embeddings.py @@ -9,7 +9,7 @@ from abc import ABC, abstractmethod import httpx -from vector_search.schema import DEFAULT_DIMENSIONS +from redis_vector_search.schema import DEFAULT_DIMENSIONS logger = logging.getLogger(__name__) diff --git a/vector-search-py/src/vector_search/py.typed b/redis-vector-search-py/src/redis_vector_search/py.typed similarity index 100% rename from vector-search-py/src/vector_search/py.typed rename to redis-vector-search-py/src/redis_vector_search/py.typed diff --git a/vector-search-py/src/vector_search/redis_client.py b/redis-vector-search-py/src/redis_vector_search/redis_client.py similarity index 100% rename from vector-search-py/src/vector_search/redis_client.py rename to redis-vector-search-py/src/redis_vector_search/redis_client.py diff --git a/vector-search-py/src/vector_search/schema.py b/redis-vector-search-py/src/redis_vector_search/schema.py similarity index 100% rename from vector-search-py/src/vector_search/schema.py rename to redis-vector-search-py/src/redis_vector_search/schema.py diff --git a/vector-search-py/src/vector_search/semantic.py b/redis-vector-search-py/src/redis_vector_search/semantic.py similarity index 97% rename from vector-search-py/src/vector_search/semantic.py rename to redis-vector-search-py/src/redis_vector_search/semantic.py index 8669a9c..bd37580 100644 --- a/vector-search-py/src/vector_search/semantic.py +++ b/redis-vector-search-py/src/redis_vector_search/semantic.py @@ -9,9 +9,9 @@ import logging from dataclasses import dataclass, field from typing import Any -from vector_search.vector_store import VectorStore, TextChunk -from vector_search.embeddings import EmbeddingProvider -from vector_search.schema import DEFAULT_CHUNK_SIZE, DEFAULT_CHUNK_OVERLAP +from redis_vector_search.vector_store import VectorStore, TextChunk +from redis_vector_search.embeddings import EmbeddingProvider +from redis_vector_search.schema import DEFAULT_CHUNK_SIZE, DEFAULT_CHUNK_OVERLAP logger = logging.getLogger(__name__) diff --git a/vector-search-py/src/vector_search/vector_store.py b/redis-vector-search-py/src/redis_vector_search/vector_store.py similarity index 99% rename from vector-search-py/src/vector_search/vector_store.py rename to redis-vector-search-py/src/redis_vector_search/vector_store.py index 972aa1a..93461cd 100644 --- a/vector-search-py/src/vector_search/vector_store.py +++ b/redis-vector-search-py/src/redis_vector_search/vector_store.py @@ -16,7 +16,7 @@ from typing import Any import redis.asyncio as redis -from vector_search.schema import ( +from redis_vector_search.schema import ( DEFAULT_INDEX_NAME, DEFAULT_KEY_PREFIX, DEFAULT_DIMENSIONS, diff --git a/redis-vector-search-py/tests/__init__.py b/redis-vector-search-py/tests/__init__.py new file mode 100644 index 0000000..ee5906e --- /dev/null +++ b/redis-vector-search-py/tests/__init__.py @@ -0,0 +1 @@ +# Tests for lilith-redis-vector-search diff --git a/vector-search-py/tests/test_semantic.py b/redis-vector-search-py/tests/test_semantic.py similarity index 100% rename from vector-search-py/tests/test_semantic.py rename to redis-vector-search-py/tests/test_semantic.py diff --git a/vector-search-py/tests/__init__.py b/vector-search-py/tests/__init__.py deleted file mode 100644 index 480c9e0..0000000 --- a/vector-search-py/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Tests for lilith-vector-search