|
| 1 | +# CLAUDE.md - RedisVL Project Context |
| 2 | + |
| 3 | +## Frequently Used Commands |
| 4 | + |
| 5 | +```bash |
| 6 | +# Development workflow |
| 7 | +make install # Install dependencies |
| 8 | +make format # Format code (black + isort) |
| 9 | +make check-types # Run mypy type checking |
| 10 | +make lint # Run all linting (format + types) |
| 11 | +make test # Run tests (no external APIs) |
| 12 | +make test-all # Run all tests (includes API tests) |
| 13 | +make check # Full check (lint + test) |
| 14 | + |
| 15 | +# Redis setup |
| 16 | +make redis-start # Start Redis Stack container |
| 17 | +make redis-stop # Stop Redis Stack container |
| 18 | + |
| 19 | +# Documentation |
| 20 | +make docs-build # Build documentation |
| 21 | +make docs-serve # Serve docs locally |
| 22 | +``` |
| 23 | + |
| 24 | +## Important Architectural Patterns |
| 25 | + |
| 26 | +### Async/Sync Dual Interfaces |
| 27 | +- Most core classes have both sync and async versions (e.g., `SearchIndex` / `AsyncSearchIndex`) |
| 28 | +- Follow existing patterns when adding new functionality |
| 29 | + |
| 30 | +### Schema-Driven Design |
| 31 | +```python |
| 32 | +# Index schemas define structure |
| 33 | +schema = IndexSchema.from_yaml("schema.yaml") |
| 34 | +index = SearchIndex(schema, redis_url="redis://localhost:6379") |
| 35 | +``` |
| 36 | + |
| 37 | +## Critical Rules |
| 38 | + |
| 39 | +### Do Not Modify |
| 40 | +- **CRITICAL**: Do not change this line unless explicitly asked: |
| 41 | + ```python |
| 42 | + token.strip().strip(",").replace(""", "").replace(""", "").lower() |
| 43 | + ``` |
| 44 | + |
| 45 | +### README.md Maintenance |
| 46 | +**IMPORTANT**: DO NOT modify README.md unless explicitly requested. |
| 47 | + |
| 48 | +**If you need to document something, use these alternatives:** |
| 49 | +- Development info → CONTRIBUTING.md |
| 50 | +- API details → docs/ directory |
| 51 | +- Examples → docs/examples/ |
| 52 | +- Project memory (explicit preferences, directives, etc.) → CLAUDE.md |
| 53 | + |
| 54 | +## Testing Notes |
| 55 | +RedisVL uses `pytest` with `testcontainers` for testing. |
| 56 | + |
| 57 | +- `make test` - unit tests only (no external APIs) |
| 58 | +- `make test-all` - includes integration tests requiring API keys |
| 59 | + |
| 60 | +## Project Structure |
| 61 | + |
| 62 | +``` |
| 63 | +redisvl/ |
| 64 | +├── cli/ # Command-line interface (rvl command) |
| 65 | +├── extensions/ # AI extensions (cache, memory, routing) |
| 66 | +│ ├── cache/ # Semantic caching for LLMs |
| 67 | +│ ├── llmcache/ # LLM-specific caching |
| 68 | +│ ├── message_history/ # Chat history management |
| 69 | +│ ├── router/ # Semantic routing |
| 70 | +│ └── session_manager/ # Session management |
| 71 | +├── index/ # SearchIndex classes (sync/async) |
| 72 | +├── query/ # Query builders (Vector, Range, Filter, Count) |
| 73 | +├── redis/ # Redis client utilities |
| 74 | +├── schema/ # Index schema definitions |
| 75 | +└── utils/ # Utilities (vectorizers, rerankers, optimization) |
| 76 | + ├── optimize/ # Threshold optimization |
| 77 | + ├── rerank/ # Result reranking |
| 78 | + └── vectorize/ # Embedding providers integration |
| 79 | +``` |
| 80 | + |
| 81 | +## Core Components |
| 82 | + |
| 83 | +### 1. Index Management |
| 84 | +- `SearchIndex` / `AsyncSearchIndex` - Main interface for Redis vector indices |
| 85 | +- `IndexSchema` - Define index structure with fields (text, tags, vectors, etc.) |
| 86 | +- Support for JSON and Hash storage types |
| 87 | + |
| 88 | +### 2. Query System |
| 89 | +- `VectorQuery` - Semantic similarity search |
| 90 | +- `RangeQuery` - Vector search within distance range |
| 91 | +- `FilterQuery` - Metadata filtering and full-text search |
| 92 | +- `CountQuery` - Count matching records |
| 93 | +- Etc. |
| 94 | + |
| 95 | +### 3. AI Extensions |
| 96 | +- `SemanticCache` - LLM response caching with semantic similarity |
| 97 | +- `EmbeddingsCache` - Cache for vector embeddings |
| 98 | +- `MessageHistory` - Chat history with recency/relevancy retrieval |
| 99 | +- `SemanticRouter` - Route queries to topics/intents |
| 100 | + |
| 101 | +### 4. Vectorizers (Optional Dependencies) |
| 102 | +- OpenAI, Azure OpenAI, Cohere, HuggingFace, Mistral, VoyageAI |
| 103 | +- Custom vectorizer support |
| 104 | +- Batch processing capabilities |
| 105 | + |
| 106 | +## Documentation |
| 107 | +- Main docs: https://docs.redisvl.com |
| 108 | +- Built with Sphinx from `docs/` directory |
| 109 | +- Includes API reference and user guides |
| 110 | +- Example notebooks in documentation `docs/user_guide/...` |
0 commit comments