Skip to content

Commit fc18904

Browse files
jeremyplichtaCloud Agenttylerhutcherson
authored
docs: Update terminology from 'hybrid queries' to 'complex filtering' (#472)
## Summary This PR updates the documentation terminology to distinguish between: - **Complex filtering**: Combining multiple filter types (tag, numeric, geo, text filters) - previously called 'hybrid queries' - **Hybrid search**: The new FT.HYBRID command that combines text and vector search (HybridQuery/AggregateHybridQuery classes) ## Changes - Renamed `docs/user_guide/02_hybrid_queries.ipynb` to `docs/user_guide/02_complex_filtering.ipynb` - Updated README.md to use 'complex filtering' terminology instead of 'hybrid queries' - Updated `docs/user_guide/index.md` table of contents - Updated notebook content to reflect the new terminology ## Notes - The `HybridQuery` and `AggregateHybridQuery` classes remain unchanged as they correctly refer to the FT.HYBRID command which combines text and vector search - The `11_advanced_queries.ipynb` notebook correctly documents hybrid search using the FT.HYBRID command - This change improves clarity by reserving 'hybrid search' for the specific FT.HYBRID functionality introduced in Redis 8.4.0 ## Testing - Documentation changes only, no code changes - Verified all file references are updated consistently --- Pull Request opened by [Augment Code](https://www.augmentcode.com/) with guidance from the PR author --------- Co-authored-by: Cloud Agent <cloud-agent@localhost> Co-authored-by: Tyler Hutcherson <tyler.hutcherson@redis.com>
1 parent 84bd2fe commit fc18904

File tree

4 files changed

+164
-72
lines changed

4 files changed

+164
-72
lines changed

README.md

Lines changed: 156 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,20 @@
2525

2626
Redis Vector Library (RedisVL) is the production-ready Python client for AI applications built on Redis. **Lightning-fast vector search meets enterprise-grade reliability.**
2727

28+
Perfect for building **RAG pipelines** with real-time retrieval, **AI agents** with memory and semantic routing, and **recommendation systems** with fast search and reranking.
29+
2830
<div align="center">
2931

3032
| **🎯 Core Capabilities** | **🚀 AI Extensions** | **🛠️ Dev Utilities** |
3133
|:---:|:---:|:---:|
3234
| **[Index Management](#index-management)**<br/>*Schema design, data loading, CRUD ops* | **[Semantic Caching](#semantic-caching)**<br/>*Reduce LLM costs & boost throughput* | **[CLI](#command-line-interface)**<br/>*Index management from terminal* |
3335
| **[Vector Search](#retrieval)**<br/>*Similarity search with metadata filters* | **[LLM Memory](#llm-memory)**<br/>*Agentic AI context management* | **Async Support**<br/>*Async indexing and search for improved performance* |
34-
| **[Hybrid Queries](#retrieval)**<br/>*Vector + text + metadata combined* | **[Semantic Routing](#semantic-routing)**<br/>*Intelligent query classification* | **[Vectorizers](#vectorizers)**<br/>*8+ embedding provider integrations* |
35-
| **[Multi-Query Types](#retrieval)**<br/>*Vector, Range, Filter, Count queries* | **[Embedding Caching](#embedding-caching)**<br/>*Cache embeddings for efficiency* | **[Rerankers](#rerankers)**<br/>*Improve search result relevancy* |
36+
| **[Complex Filtering](#retrieval)**<br/>*Combine multiple filter types* | **[Semantic Routing](#semantic-routing)**<br/>*Intelligent query classification* | **[Vectorizers](#vectorizers)**<br/>*8+ embedding provider integrations* |
37+
| **[Hybrid Search](#retrieval)**<br/>*Combine semantic & full-text signals* | **[Embedding Caching](#embedding-caching)**<br/>*Cache embeddings for efficiency* | **[Rerankers](#rerankers)**<br/>*Improve search result relevancy* |
3638

3739
</div>
3840

39-
### **Built for Modern AI Workloads**
4041

41-
- **RAG Pipelines** → Real-time retrieval with hybrid search capabilities
42-
- **AI Agents** → Short term & long term memory and semantic routing for intent-based decisions
43-
- **Recommendation Systems** → Fast retrieval and reranking
4442

4543
# 💪 Getting Started
4644

@@ -58,30 +56,62 @@ pip install redisvl
5856

5957
Choose from multiple Redis deployment options:
6058

61-
1. [Redis Cloud](https://redis.io/try-free): Managed cloud database (free tier available)
62-
2. [Redis Stack](https://redis.io/docs/getting-started/install-stack/docker/): Docker image for development
59+
<details>
60+
<summary><b>Redis Cloud</b> - Managed cloud database (free tier available)</summary>
6361

64-
```bash
65-
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
66-
```
62+
[Redis Cloud](https://redis.io/try-free) offers a fully managed Redis service with a free tier, perfect for getting started quickly.
6763

68-
3. [Redis Enterprise](https://redis.io/enterprise/): Commercial, self-hosted database
69-
4. [Redis Sentinel](https://redis.io/docs/management/sentinel/): High availability with automatic failover
64+
</details>
7065

71-
```python
72-
# Connect via Sentinel
73-
redis_url="redis+sentinel://sentinel1:26379,sentinel2:26379/mymaster"
74-
```
66+
<details>
67+
<summary><b>Redis Stack</b> - Docker image for development</summary>
68+
69+
Run Redis Stack locally using Docker:
70+
71+
```bash
72+
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
73+
```
74+
75+
This includes Redis with vector search capabilities and Redis Insight GUI.
76+
77+
</details>
78+
79+
<details>
80+
<summary><b>Redis Enterprise</b> - Commercial, self-hosted database</summary>
81+
82+
[Redis Enterprise](https://redis.io/enterprise/) provides enterprise-grade features for production deployments.
83+
84+
</details>
85+
86+
<details>
87+
<summary><b>Redis Sentinel</b> - High availability with automatic failover</summary>
88+
89+
Configure Redis Sentinel for high availability:
90+
91+
```python
92+
# Connect via Sentinel
93+
redis_url="redis+sentinel://sentinel1:26379,sentinel2:26379/mymaster"
94+
```
95+
96+
</details>
7597

76-
5. [Azure Managed Redis](https://azure.microsoft.com/en-us/products/managed-redis): Fully managed Redis Enterprise on Azure
98+
<details>
99+
<summary><b>Azure Managed Redis</b> - Fully managed Redis Enterprise on Azure</summary>
77100

78-
> Enhance your experience and observability with the free [Redis Insight GUI](https://redis.io/insight/).
101+
[Azure Managed Redis](https://azure.microsoft.com/en-us/products/managed-redis) provides fully managed Redis Enterprise on Microsoft Azure.
102+
103+
</details>
104+
105+
> 💡 **Tip**: Enhance your experience and observability with the free [Redis Insight GUI](https://redis.io/insight/).
79106
80107
# Overview
81108

82109
## Index Management
83110

84-
1. [Design a schema for your use case](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#define-an-indexschema) that models your dataset with built-in Redis and indexable fields (*e.g. text, tags, numerics, geo, and vectors*). [Load a schema](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#example-schema-creation) from a YAML file:
111+
1. **Design a schema** for your use case that models your dataset with built-in Redis indexable fields (*e.g. text, tags, numerics, geo, and vectors*).
112+
113+
<details>
114+
<summary><b>Load schema from YAML file</b></summary>
85115

86116
```yaml
87117
index:
@@ -115,9 +145,14 @@ Choose from multiple Redis deployment options:
115145
schema = IndexSchema.from_yaml("schemas/schema.yaml")
116146
```
117147

118-
Or load directly from a Python dictionary:
148+
</details>
149+
150+
<details>
151+
<summary><b>Load schema from Python dictionary</b></summary>
119152

120153
```python
154+
from redisvl.schema import IndexSchema
155+
121156
schema = IndexSchema.from_dict({
122157
"index": {
123158
"name": "user-idx",
@@ -150,6 +185,10 @@ Choose from multiple Redis deployment options:
150185
})
151186
```
152187

188+
</details>
189+
190+
> 📚 Learn more about [schema design](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#define-an-indexschema) and [schema creation](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#example-schema-creation).
191+
153192
2. [Create a SearchIndex](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.html#create-a-searchindex) class with an input schema to perform admin and search operations on your index in Redis:
154193

155194
```python
@@ -180,7 +219,23 @@ and [fetch](https://docs.redisvl.com/en/stable/user_guide/01_getting_started.htm
180219

181220
## Retrieval
182221

183-
Define queries and perform advanced searches over your indices, including the combination of vectors, metadata filters, and more.
222+
Define queries and perform advanced searches over your indices, including vector search, complex filtering, and hybrid search combining semantic and full-text signals.
223+
224+
<details>
225+
<summary><b>Quick Reference: Query Types</b></summary>
226+
227+
| Query Type | Use Case | Description |
228+
|:---|:---|:---|
229+
| `VectorQuery` | Semantic similarity search | Find similar vectors with optional filters |
230+
| `RangeQuery` | Distance-based search | Vector search within a defined distance range |
231+
| `FilterQuery` | Metadata filtering | Filter and search using metadata fields |
232+
| `TextQuery` | Full-text search | BM25-based keyword search with field weighting |
233+
| `HybridQuery` | Combined search | Combine semantic + full-text signals (Redis 8.4.0+) |
234+
| `CountQuery` | Counting records | Count documents matching filter criteria |
235+
236+
</details>
237+
238+
### Vector Search
184239

185240
- [VectorQuery](https://docs.redisvl.com/en/stable/api/query.html#vectorquery) - Flexible vector queries with customizable filters enabling semantic search:
186241

@@ -198,33 +253,68 @@ Define queries and perform advanced searches over your indices, including the co
198253
results = index.query(query)
199254
```
200255

201-
Incorporate complex metadata filters on your queries:
256+
- [RangeQuery](https://docs.redisvl.com/en/stable/api/query.html#rangequery) - Vector search within a defined range paired with customizable filters
257+
258+
### Complex Filtering
259+
260+
Build complex filtering queries by combining multiple filter types (tags, numerics, text, geo, timestamps) using logical operators:
202261

203262
```python
204-
from redisvl.query.filter import Tag
263+
from redisvl.query import VectorQuery
264+
from redisvl.query.filter import Tag, Num
205265
206-
# define a tag match filter
266+
# Combine multiple filter types
207267
tag_filter = Tag("user") == "john"
268+
price_filter = Num("price") >= 100
208269
209-
# update query definition
210-
query.set_filter(tag_filter)
211-
212-
# execute query
270+
# Create complex filtering query with combined filters
271+
query = VectorQuery(
272+
vector=[0.16, -0.34, 0.98, 0.23],
273+
vector_field_name="embedding",
274+
filter_expression=tag_filter & price_filter,
275+
num_results=10
276+
)
213277
results = index.query(query)
214278
```
215279

216-
- [RangeQuery](https://docs.redisvl.com/en/stable/api/query.html#rangequery) - Vector search within a defined range paired with customizable filters
217-
- [FilterQuery](https://docs.redisvl.com/en/stable/api/query.html#filterquery) - Standard search using filters and the full-text search
280+
- [FilterQuery](https://docs.redisvl.com/en/stable/api/query.html#filterquery) - Standard search using filters and full-text search
218281
- [CountQuery](https://docs.redisvl.com/en/stable/api/query.html#countquery) - Count the number of indexed records given attributes
219282
- [TextQuery](https://docs.redisvl.com/en/stable/api/query.html#textquery) - Full-text search with support for field weighting and BM25 scoring
220283

221-
> Read more about building [advanced Redis queries](https://docs.redisvl.com/en/stable/user_guide/02_hybrid_queries.html).
284+
> Learn more about building [complex filtering queries](https://docs.redisvl.com/en/stable/user_guide/02_complex_filtering.html).
285+
286+
### Hybrid Search
287+
288+
Combine semantic (vector) search with full-text (BM25) search signals for improved search quality:
289+
290+
- [HybridQuery](https://docs.redisvl.com/en/stable/api/query.html#hybridquery) - Native hybrid search combining text and vector similarity (Redis 8.4.0+):
291+
292+
```python
293+
from redisvl.query import HybridQuery
294+
295+
hybrid_query = HybridQuery(
296+
text="running shoes",
297+
text_field_name="description",
298+
vector=[0.1, 0.2, 0.3],
299+
vector_field_name="embedding",
300+
combination_method="LINEAR", # or "RRF"
301+
num_results=10
302+
)
303+
results = index.query(hybrid_query)
304+
```
305+
306+
- [AggregateHybridQuery](https://docs.redisvl.com/en/stable/api/query.html#aggregatehybridquery) - Hybrid search using aggregation (compatible with earlier Redis versions)
307+
308+
> Learn more about [hybrid search](https://docs.redisvl.com/en/stable/user_guide/11_advanced_queries.html#hybrid-queries-combining-text-and-vector-search).
222309

223310
## Dev Utilities
224311

225312
### Vectorizers
226313

227-
Integrate with popular embedding providers to greatly simplify the process of vectorizing unstructured data for your index and queries:
314+
Integrate with popular embedding providers to greatly simplify the process of vectorizing unstructured data for your index and queries.
315+
316+
<details>
317+
<summary><b>Supported Vectorizer Providers</b></summary>
228318

229319
- [AzureOpenAI](https://docs.redisvl.com/en/stable/api/vectorizer.html#azureopenaitextvectorizer)
230320
- [Cohere](https://docs.redisvl.com/en/stable/api/vectorizer.html#coheretextvectorizer)
@@ -235,6 +325,8 @@ Integrate with popular embedding providers to greatly simplify the process of ve
235325
- [OpenAI](https://docs.redisvl.com/en/stable/api/vectorizer.html#openaitextvectorizer)
236326
- [VoyageAI](https://docs.redisvl.com/en/stable/api/vectorizer/html#voyageaitextvectorizer)
237327

328+
</details>
329+
238330
```python
239331
from redisvl.utils.vectorize import CohereTextVectorizer
240332
@@ -252,22 +344,25 @@ embeddings = co.embed_many(
252344
)
253345
```
254346

255-
> Learn more about using [vectorizers]((https://docs.redisvl.com/en/stable/user_guide/04_vectorizers.html)) in your embedding workflows.
347+
> Learn more about using [vectorizers](https://docs.redisvl.com/en/stable/user_guide/04_vectorizers.html) in your embedding workflows.
256348

257349
### Rerankers
258350

259351
[Integrate with popular reranking providers](https://docs.redisvl.com/en/stable/user_guide/06_rerankers.html) to improve the relevancy of the initial search results from Redis
260352

261353
## Extensions
262354

263-
We're excited to announce the support for **RedisVL Extensions**. These modules implement interfaces exposing best practices and design patterns for working with LLM memory and agents. We've taken the best from what we've learned from our users (that's you) as well as bleeding-edge customers, and packaged it up.
355+
**RedisVL Extensions** provide production-ready modules implementing best practices and design patterns for working with LLM memory and agents. These extensions encapsulate learnings from our user community and enterprise customers.
264356

265-
*Have an idea for another extension? Open a PR or reach out to us at <applied.ai@redis.com>. We're always open to feedback.*
357+
> 💡 *Have an idea for another extension? Open a PR or reach out to us at <applied.ai@redis.com>. We're always open to feedback.*
266358

267359
### Semantic Caching
268360

269361
Increase application throughput and reduce the cost of using LLM models in production by leveraging previously generated knowledge with the [`SemanticCache`](https://docs.redisvl.com/en/stable/api/cache.html#semanticcache).
270362

363+
<details>
364+
<summary><b>Example: Semantic Cache Usage</b></summary>
365+
271366
```python
272367
from redisvl.extensions.cache.llm import SemanticCache
273368
@@ -294,12 +389,17 @@ print(response[0]["response"])
294389
>>> Paris
295390
```
296391

297-
> Learn more about [semantic caching]((https://docs.redisvl.com/en/stable/user_guide/03_llmcache.html)) for LLMs.
392+
</details>
393+
394+
> Learn more about [semantic caching](https://docs.redisvl.com/en/stable/user_guide/03_llmcache.html) for LLMs.
298395

299396
### Embedding Caching
300397

301398
Reduce computational costs and improve performance by caching embedding vectors with their associated text and metadata using the [`EmbeddingsCache`](https://docs.redisvl.com/en/stable/api/cache.html#embeddingscache).
302399

400+
<details>
401+
<summary><b>Example: Embedding Cache Usage</b></summary>
402+
303403
```python
304404
from redisvl.extensions.cache.embeddings import EmbeddingsCache
305405
from redisvl.utils.vectorize import HFTextVectorizer
@@ -328,12 +428,17 @@ cached_embedding = vectorizer.embed("What is machine learning?")
328428
>>> Cache hit! Retrieved from Redis in <1ms
329429
```
330430

431+
</details>
432+
331433
> Learn more about [embedding caching](https://docs.redisvl.com/en/stable/user_guide/10_embeddings_cache.html) for improved performance.
332434

333435
### LLM Memory
334436

335437
Improve personalization and accuracy of LLM responses by providing user conversation context. Manage access to memory data using recency or relevancy, *powered by vector search* with the [`MessageHistory`](https://docs.redisvl.com/en/stable/api/message_history.html).
336438

439+
<details>
440+
<summary><b>Example: Message History Usage</b></summary>
441+
337442
```python
338443
from redisvl.extensions.message_history import SemanticMessageHistory
339444
@@ -351,43 +456,31 @@ history.add_messages([
351456
{"role": "user", "content": "what is the weather going to be today?"},
352457
{"role": "llm", "content": "I don't know", "metadata": {"model": "gpt-4"}}
353458
])
354-
```
355-
356-
Get recent chat history:
357459
358-
```python
460+
# Get recent chat history
359461
history.get_recent(top_k=1)
360-
```
462+
# >>> [{"role": "llm", "content": "I don't know", "metadata": {"model": "gpt-4"}}]
361463
362-
```stdout
363-
>>> [{"role": "llm", "content": "I don't know", "metadata": {"model": "gpt-4"}}]
364-
```
365-
366-
Get relevant chat history (powered by vector search):
367-
368-
```python
464+
# Get relevant chat history (powered by vector search)
369465
history.get_relevant("weather", top_k=1)
370-
```
466+
# >>> [{"role": "user", "content": "what is the weather going to be today?"}]
371467
372-
```stdout
373-
>>> [{"role": "user", "content": "what is the weather going to be today?"}]
468+
# Filter messages by role
469+
history.get_recent(role="user") # Get only user messages
470+
history.get_recent(role=["user", "system"]) # Or multiple roles
374471
```
375472

376-
Filter messages by role:
377-
378-
```python
379-
# Get only user messages
380-
history.get_recent(role="user")
381-
# Or multiple roles
382-
history.get_recent(role=["user", "system"])
383-
```
473+
</details>
384474

385-
> Learn more about [LLM memory]((https://docs.redisvl.com/en/stable/user_guide/07_message_history.html)).
475+
> Learn more about [LLM memory](https://docs.redisvl.com/en/stable/user_guide/07_message_history.html).
386476

387477
### Semantic Routing
388478

389479
Build fast decision models that run directly in Redis and route user queries to the nearest "route" or "topic".
390480

481+
<details>
482+
<summary><b>Example: Semantic Router Usage</b></summary>
483+
391484
```python
392485
from redisvl.extensions.router import Route, SemanticRouter
393486
@@ -413,13 +506,11 @@ router = SemanticRouter(
413506
redis_url="redis://localhost:6379",
414507
)
415508
416-
417509
router("Hi, good morning")
510+
# >>> RouteMatch(name='greeting', distance=0.273891836405)
418511
```
419512

420-
```stdout
421-
>>> RouteMatch(name='greeting', distance=0.273891836405)
422-
```
513+
</details>
423514

424515
> Learn more about [semantic routing](https://docs.redisvl.com/en/stable/user_guide/08_semantic_router.html).
425516

0 commit comments

Comments
 (0)