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
Copy file name to clipboardExpand all lines: README.md
+31-30
Original file line number
Diff line number
Diff line change
@@ -32,23 +32,13 @@
32
32
33
33
Welcome to the Redis Vector Library – the ultimate Python client designed for AI applications harnessing the power of [Redis](https://redis.io).
34
34
35
-
`redisvl` is your go-to tool for:
35
+
[redisvl](https://pypi.org/project/redisvl/) is your go-to tool for:
36
36
37
37
- Lightning-fast information retrieval & vector similarity search
38
38
- Real-time RAG pipelines
39
39
- Agentic memory structures
40
40
- Smart recommendation engines
41
41
42
-
## 🚀 Why RedisVL?
43
-
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**.
45
-
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.
47
-
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.
49
-
50
-
Unleash the full potential of Redis for your AI projects with `redisvl`.
51
-
52
42
53
43
# 💪 Getting Started
54
44
@@ -84,9 +74,9 @@ Choose from multiple Redis deployment options:
84
74
1. [Design a schema for your use case](https://www.redisvl.com/user_guide/getting_started_01.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://www.redisvl.com/user_guide/getting_started_01.html#example-schema-creation) from a YAML file:
85
75
```yaml
86
76
index:
87
-
name: user-index-v1
88
-
prefix: user
89
-
storage_type: json
77
+
name: user-idx
78
+
prefix: user
79
+
storage_type: json
90
80
91
81
fields:
92
82
- name: user
@@ -96,10 +86,10 @@ Choose from multiple Redis deployment options:
96
86
- name: embedding
97
87
type: vector
98
88
attrs:
99
-
algorithm: flat
100
-
dims: 3
101
-
distance_metric: cosine
102
-
datatype: float32
89
+
algorithm: flat
90
+
dims: 3
91
+
distance_metric: cosine
92
+
datatype: float32
103
93
```
104
94
```python
105
95
from redisvl.schema import IndexSchema
@@ -110,7 +100,7 @@ Choose from multiple Redis deployment options:
110
100
```python
111
101
schema = IndexSchema.from_dict({
112
102
"index": {
113
-
"name": "user-index-v1",
103
+
"name": "user-idx",
114
104
"prefix": "user",
115
105
"storage_type": "json"
116
106
},
@@ -143,7 +133,7 @@ Choose from multiple Redis deployment options:
143
133
# Create the index in Redis
144
134
index.create()
145
135
```
146
-
> Async compliant search index class also available: `AsyncSearchIndex`
136
+
> Async compliant search index class also available: [AsyncSearchIndex](https://www.redisvl.com/api/searchindex.html#redisvl.index.AsyncSearchIndex).
and [fetch](https://www.redisvl.com/user_guide/getting_started_01.html#fetch-an-object-from-redis) data to/from your Redis instance:
@@ -255,30 +245,30 @@ llmcache = SemanticCache(
255
245
# store user queries and LLM responses in the semantic cache
256
246
llmcache.store(
257
247
prompt="What is the capital city of France?",
258
-
response="Paris",
259
-
metadata={}
248
+
response="Paris"
260
249
)
261
250
262
251
# quickly check the cache with a slightly different prompt (before invoking an LLM)
263
252
response = llmcache.check(prompt="What is France's capital city?")
264
253
print(response[0]["response"])
265
254
```
266
255
```stdout
267
-
>>> "Paris"
256
+
>>> Paris
268
257
```
269
258
270
259
> Learn more about [semantic caching]((https://www.redisvl.com/user_guide/llmcache_03.html))for LLMs.
271
260
272
261
### LLM Session Management
273
262
274
-
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`]().
263
+
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`](https://www.redisvl.com/api/session_manager.html).
275
264
276
265
```python
277
266
from redisvl.extensions.session_manager import SemanticSessionManager
278
267
279
268
session = SemanticSessionManager(
280
269
name="my-session",
281
-
redis_url="redis://localhost:6379"
270
+
redis_url="redis://localhost:6379",
271
+
distance_threshold=0.7
282
272
)
283
273
284
274
session.add_messages([
@@ -293,14 +283,14 @@ Get recent chat history:
293
283
session.get_recent(top_k=1)
294
284
```
295
285
```stdout
296
-
>>> {"role": "assistant", "content": "I don't know"}
286
+
>>> [{"role": "assistant", "content": "I don't know"}]
297
287
```
298
288
Get relevant chat history (powered by vector search):
299
289
```python
300
290
session.get_relevant("weather", top_k=1)
301
291
```
302
292
```stdout
303
-
>>> {"role": "user", "content": "what is the weather going to be today?"}
293
+
>>> [{"role": "user", "content": "what is the weather going to be today?"}]
304
294
```
305
295
> Learn more about [LLM session management]((https://www.redisvl.com/user_guide/session_manager_07.html)).
> Learn more about [semantic routing](https://www.redisvl.com/user_guide/semantic_router_08.html).
341
333
@@ -353,7 +345,16 @@ Commands:
353
345
stats Obtain statistics about an index
354
346
```
355
347
356
-
> Read more about using the [CLI](https://www.redisvl.com/user_guide/cli.html).
348
+
> Read more about [using the CLI](https://www.redisvl.com/user_guide/cli.html).
349
+
350
+
## 🚀 Why RedisVL?
351
+
352
+
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 rapid. Yet, many organizations face the challenge of delivering AI solutions **quickly** and at **scale**.
353
+
354
+
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.
355
+
356
+
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.
0 commit comments