feat(@ml/redis-vector-search-py): ✨ Add Redis vector search package
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 <noreply@anthropic.com>
This commit is contained in:
parent
61d8e3b242
commit
ec16be002f
14 changed files with 28 additions and 28 deletions
|
|
@ -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",
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 91722cedcbf74fe03586081e7e20f28ea9364f30
|
||||
Subproject commit ce019c78e7c63ae2ebc68276e20a8effac37a721
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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 = [
|
||||
|
|
@ -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)
|
||||
|
|
@ -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__)
|
||||
|
||||
|
|
@ -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__)
|
||||
|
||||
|
|
@ -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,
|
||||
1
redis-vector-search-py/tests/__init__.py
Normal file
1
redis-vector-search-py/tests/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Tests for lilith-redis-vector-search
|
||||
|
|
@ -1 +0,0 @@
|
|||
# Tests for lilith-vector-search
|
||||
Loading…
Add table
Reference in a new issue