You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Python Redis Vector Library (RedisVL) is a tailor-made client for AI applications leveraging [Redis](https://redis.com).
33
+
Welcome to the Redis Vector Library (`redisvl`) – the ultimate Python client designed for AI applications harnessing the power of [Redis](https://redis.io).
30
34
31
-
It's specifically designed for:
35
+
`redisvl` is your go-to tool for:
32
36
33
-
-Information retrieval & vector similarity search
37
+
-Lightning-fast information retrieval & vector similarity search
34
38
- Real-time RAG pipelines
35
-
- Recommendation engines
39
+
- Agentic memory structures
40
+
- Smart recommendation engines
36
41
37
-
Enhance your applications with Redis' **speed**, **flexibility**, and **reliability**, incorporating capabilities like vector-based semantic search, full-text search, and geo-spatial search.
42
+
## 🚀 Why RedisVL?
38
43
39
-
# 🚀 Why RedisVL?
44
+
In the age of GenAI, **vector databases** and **LLMs** are transforming information retrieval systems. With emerging and popular frameworks like [LangChain](https://github.com/langchain-ai/langchain) and [LlamaIndex](https://www.llamaindex.ai/), innovation is soaring. Yet, many organizations face the challenge of delivering AI solutions **quickly** and at **scale**.
40
45
41
-
The emergence of the modern GenAI stack, including **vector databases** and **LLMs**, has become increasingly popular due to accelerated innovation & research in information retrieval, the ubiquity of tools & frameworks (e.g. [LangChain](https://github.com/langchain-ai/langchain), [LlamaIndex](https://www.llamaindex.ai/), [EmbedChain](https://github.com/embedchain/embedchain)), and the never-ending stream of business problems addressable by AI.
46
+
Enter [Redis](https://redis.io) – a cornerstone of the NoSQL world, renowned for its versatile [data structures](https://redis.io/docs/data-types/) and [processing engines](https://redis.io/docs/interact/). Redis excels in real-time workloads like caching, session management, and search. It's also a powerhouse as a vector database for RAG, an LLM cache, and a chat session memory store for conversational AI.
42
47
43
-
However, organizations still struggle with delivering reliable solutions **quickly** (*time to value*) at **scale** (*beyond a demo*).
48
+
The Redis Vector Library bridges the gap between the AI-native developer ecosystem and Redis's robust capabilities. With a lightweight, elegant, and intuitive interface, RedisVL makes it easy to leverage Redis's power. Built on the [Redis Python](https://github.com/redis/redis-py/tree/master) client, `redisvl` transforms Redis's features into a grammar perfectly aligned with the needs of today's AI/ML Engineers and Data Scientists.
44
49
45
-
[Redis](https://redis.io) has been a staple for over a decade in the NoSQL world, and boasts a number of flexible [data structures](https://redis.io/docs/data-types/) and [processing engines](https://redis.io/docs/interact/) to handle realtime application workloads like caching, session management, and search. Most notably, Redis has been used as a vector database for RAG, as an LLM cache, and chat session memory store for conversational AI applications.
50
+
Unleash the full potential of Redis for your AI projects with `redisvl`.
46
51
47
-
The vector library **bridges the gap between** the emerging AI-native developer ecosystem and the capabilities of Redis by providing a lightweight, elegant, and intuitive interface. Built on the back of the popular Python client, [`redis-py`](https://github.com/redis/redis-py/tree/master), it abstracts the features Redis into a grammar that is more aligned to the needs of today's AI/ML Engineers or Data Scientists.
4. [Azure Cache for Redis Enterprise](https://learn.microsoft.com/azure/azure-cache-for-redis/quickstart-create-redis-enterprise): Fully managed Redis Enterprise on Azure
72
76
73
77
> Enhance your experience and observability with the free [Redis Insight GUI](https://redis.com/redis-enterprise/redis-insight/).
74
78
75
79
76
-
## What's included?
80
+
# Overview
77
81
78
82
79
-
### 🗃️ Redis Index Management
83
+
## 🗃️ Redis Index Management
80
84
1. [Design an `IndexSchema`](https://www.redisvl.com/user_guide/getting_started_01.html#define-an-indexschema) that models your dataset with built-in Redis [data structures](https://www.redisvl.com/user_guide/hash_vs_json_05.html) (*Hash or JSON*) and indexable fields (*e.g. text, tags, numerics, geo, and vectors*).
81
85
82
-
[Load a schema](https://www.redisvl.com/user_guide/getting_started_01.html#example-schema-creation) from a [YAML file](schemas/schema.yaml):
86
+
[Load a schema](https://www.redisvl.com/user_guide/getting_started_01.html#example-schema-creation) from a YAML file:
83
87
```yaml
84
88
index:
85
89
name: user-index-v1
@@ -155,7 +159,7 @@ and [fetch](https://www.redisvl.com/user_guide/getting_started_01.html#fetch-an-
155
159
john = index.fetch("john")
156
160
```
157
161
158
-
### 🔍 Realtime Search
162
+
## 🔍 Realtime Search
159
163
160
164
Define queries and perform advanced searches over your indices, including the combination of vectors, metadata filters, and more.
161
165
@@ -191,10 +195,10 @@ Define queries and perform advanced searches over your indices, including the co
191
195
- [FilterQuery](https://www.redisvl.com/api/query.html#filterquery) - Standard search using filters and the full-text search
192
196
- [CountQuery](https://www.redisvl.com/api/query.html#countquery) - Count the number of indexed records given attributes
193
197
194
-
> Read more about building advanced Redis queries [here](https://www.redisvl.com/user_guide/hybrid_queries_02.html).
198
+
> Read more about building [advanced Redis queries](https://www.redisvl.com/user_guide/hybrid_queries_02.html).
195
199
196
200
197
-
### 🖥️ Command Line Interface
201
+
## 🖥️ Command Line Interface
198
202
Create, destroy, and manage Redis index configurations from a purpose-built CLI interface: `rvl`.
199
203
200
204
```bash
@@ -208,15 +212,19 @@ Commands:
208
212
stats Obtain statistics about an index
209
213
```
210
214
211
-
> Read more about using the `redisvl` CLI [here](https://www.redisvl.com/user_guide/cli.html).
215
+
> Read more about using the `redisvl` [CLI](https://www.redisvl.com/user_guide/cli.html).
216
+
217
+
## 🔧 Utilities
212
218
213
-
### ⚡ Community Integrations
214
-
Integrate with popular embedding models and providers to greatly simplify the process of vectorizing unstructured data for your index and queries:
> Learn more about using `redisvl`Vectorizers in your workflows [here](https://www.redisvl.com/user_guide/vectorizers_04.html).
246
+
> Learn more about using `redisvl`[vectorizers]((https://www.redisvl.com/user_guide/vectorizers_04.html))in your embedding workflows.
239
247
240
-
### 💫 Beyond Vector Search
241
-
In order to perform well in production, modern GenAI applications require much more than vector search for retrieval. `redisvl` provides some common extensions that
242
-
aim to improve applications working with LLMs:
243
248
244
-
- **LLM Semantic Caching** is designed to increase application throughput and reduce the cost of using LLM models in production by leveraging previously generated knowledge.
249
+
### Rerankers
250
+
Integrate with popular reranking providers to improve the relevancy of the initial search results from Redis:
245
251
246
-
```python
247
-
from redisvl.extensions.llmcache import SemanticCache
248
252
249
-
# init cache with TTL (expiration) policy and semantic distance threshhold
250
-
llmcache = SemanticCache(
251
-
name="llmcache",
252
-
ttl=360,
253
-
redis_url="redis://localhost:6379"
254
-
)
255
-
llmcache.set_threshold(0.2) # can be changed on-demand
256
253
257
-
# store user queries and LLM responses in the semantic cache
258
-
llmcache.store(
259
-
prompt="What is the capital city of France?",
260
-
response="Paris",
261
-
metadata={}
262
-
)
254
+
## 💫 Extensions
255
+
To improve production performance in GenAI applications, `redisvl` provides some common extensions:
263
256
264
-
# quickly check the cache with a slightly different prompt (before invoking an LLM)
265
-
response = llmcache.check(prompt="What is France's capital city?")
266
-
print(response[0]["response"])
267
-
```
268
-
```stdout
269
-
>>> "Paris"
270
-
```
257
+
### LLM Semantic Caching
258
+
Increase application throughput and reduce the cost of using LLM models in production by leveraging previously generated knowledge with the [`SemanticCache`](https://www.redisvl.com/api/cache.html#semanticcache).
259
+
260
+
```python
261
+
from redisvl.extensions.llmcache import SemanticCache
262
+
263
+
# init cache with TTL and semantic distance threshold
264
+
llmcache = SemanticCache(
265
+
name="llmcache",
266
+
ttl=360,
267
+
redis_url="redis://localhost:6379",
268
+
distance_threshold=0.1
269
+
)
270
+
271
+
# store user queries and LLM responses in the semantic cache
272
+
llmcache.store(
273
+
prompt="What is the capital city of France?",
274
+
response="Paris",
275
+
metadata={}
276
+
)
277
+
278
+
# quickly check the cache with a slightly different prompt (before invoking an LLM)
279
+
response = llmcache.check(prompt="What is France's capital city?")
280
+
print(response[0]["response"])
281
+
```
282
+
```stdout
283
+
>>> "Paris"
284
+
```
271
285
272
-
> Learn more about Semantic Caching [here](https://www.redisvl.com/user_guide/llmcache_03.html).
286
+
> Learn more about [semantic caching]((https://www.redisvl.com/user_guide/llmcache_03.html))for LLMs with `redisvl`.
273
287
274
-
- **LLM Session Management (COMING SOON)** aims to improve personalization and accuracy of the LLM application by providing user chat session information and conversational memory.
275
-
- **LLM Contextual Access Control (COMING SOON)** aims to improve security concerns by preventing malicious, irrelevant, or problematic user input from reaching LLMs and infrastructure.
288
+
### LLM Session Management
276
289
290
+
Improve personalization and accuracy of LLM responses by providing user chat history as context. Manage access to the session data using recency or relevancy, *powered by vector search* with the [`SemanticSessionManager`]().
291
+
292
+
```python
293
+
from redisvl.extensions.session_manager import SemanticSessionManager
294
+
295
+
session = SemanticSessionManager(
296
+
name="my-session",
297
+
redis_url="redis://localhost:6379"
298
+
)
299
+
300
+
session.add_messages([
301
+
{"role": "user", "content": "hello, how are you?"},
0 commit comments