Skip to content

Commit 685de7e

Browse files
Ppdate project readme and schema definitions (#200)
1 parent 99bc5a1 commit 685de7e

File tree

2 files changed

+30
-33
lines changed

2 files changed

+30
-33
lines changed

README.md

+28-27
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,13 @@
3232

3333
Welcome to the Redis Vector Library – the ultimate Python client designed for AI applications harnessing the power of [Redis](https://redis.io).
3434

35-
`redisvl` is your go-to tool for:
35+
[redisvl](https://pypi.org/project/redisvl/) is your go-to tool for:
3636

3737
- Lightning-fast information retrieval & vector similarity search
3838
- Real-time RAG pipelines
3939
- Agentic memory structures
4040
- Smart recommendation engines
4141

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-
5242

5343
# 💪 Getting Started
5444

@@ -84,9 +74,9 @@ Choose from multiple Redis deployment options:
8474
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:
8575
```yaml
8676
index:
87-
name: user-index-v1
88-
prefix: user
89-
storage_type: json
77+
name: user-idx
78+
prefix: user
79+
storage_type: json
9080
9181
fields:
9282
- name: user
@@ -97,7 +87,7 @@ Choose from multiple Redis deployment options:
9787
type: vector
9888
attrs:
9989
algorithm: flat
100-
dims: 3
90+
dims: 4
10191
distance_metric: cosine
10292
datatype: float32
10393
```
@@ -110,7 +100,7 @@ Choose from multiple Redis deployment options:
110100
```python
111101
schema = IndexSchema.from_dict({
112102
"index": {
113-
"name": "user-index-v1",
103+
"name": "user-idx",
114104
"prefix": "user",
115105
"storage_type": "json"
116106
},
@@ -143,7 +133,7 @@ Choose from multiple Redis deployment options:
143133
# Create the index in Redis
144134
index.create()
145135
```
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).
147137

148138
3. [Load](https://www.redisvl.com/user_guide/getting_started_01.html#load-data-to-searchindex)
149139
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(
255245
# store user queries and LLM responses in the semantic cache
256246
llmcache.store(
257247
prompt="What is the capital city of France?",
258-
response="Paris",
259-
metadata={}
248+
response="Paris"
260249
)
261250
262251
# quickly check the cache with a slightly different prompt (before invoking an LLM)
263252
response = llmcache.check(prompt="What is France's capital city?")
264253
print(response[0]["response"])
265254
```
266255
```stdout
267-
>>> "Paris"
256+
>>> Paris
268257
```
269258
270259
> Learn more about [semantic caching]((https://www.redisvl.com/user_guide/llmcache_03.html)) for LLMs.
271260
272261
### LLM Session Management
273262
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).
275264
276265
```python
277266
from redisvl.extensions.session_manager import SemanticSessionManager
278267
279268
session = SemanticSessionManager(
280269
name="my-session",
281-
redis_url="redis://localhost:6379"
270+
redis_url="redis://localhost:6379",
271+
distance_threshold=0.7
282272
)
283273
284274
session.add_messages([
@@ -293,14 +283,14 @@ Get recent chat history:
293283
session.get_recent(top_k=1)
294284
```
295285
```stdout
296-
>>> {"role": "assistant", "content": "I don't know"}
286+
>>> [{"role": "assistant", "content": "I don't know"}]
297287
```
298288
Get relevant chat history (powered by vector search):
299289
```python
300290
session.get_relevant("weather", top_k=1)
301291
```
302292
```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?"}]
304294
```
305295
> Learn more about [LLM session management]((https://www.redisvl.com/user_guide/session_manager_07.html)).
306296
@@ -309,13 +299,15 @@ session.get_relevant("weather", top_k=1)
309299
Build fast decision models that run directly in Redis and route user queries to the nearest "route" or "topic".
310300
311301
```python
302+
from redisvl.extensions.router import Route, SemanticRouter
303+
312304
routes = [
313305
Route(
314306
name="greeting",
315307
references=["hello", "hi"],
316308
metadata={"type": "greeting"},
317309
distance_threshold=0.3,
318-
)
310+
),
319311
Route(
320312
name="farewell",
321313
references=["bye", "goodbye"],
@@ -335,7 +327,7 @@ router = SemanticRouter(
335327
router("Hi, good morning")
336328
```
337329
```stdout
338-
>>> RouteMatch(name='greeting', distance=0.09384023)
330+
>>> RouteMatch(name='greeting', distance=0.273891836405)
339331
```
340332
> Learn more about [semantic routing](https://www.redisvl.com/user_guide/semantic_router_08.html).
341333
@@ -353,7 +345,16 @@ Commands:
353345
stats Obtain statistics about an index
354346
```
355347
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.
357+
357358

358359
## 😁 Helpful Links
359360

schemas/schema.yaml

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
version: '0.1.0'
22

33
index:
4-
name: user-index-v1
4+
name: user-idx
55
prefix: user
6-
key_separator: ':'
76
storage_type: json
87

98
fields:
109
- name: user
1110
type: tag
12-
path: '$.user'
1311
- name: credit_score
1412
type: tag
15-
path: '$.credit_score'
1613
- name: embedding
1714
type: vector
18-
path: '$.embedding'
1915
attrs:
2016
algorithm: flat
21-
dims: 3
17+
dims: 4
2218
distance_metric: cosine
2319
datatype: float32

0 commit comments

Comments
 (0)