Skip to content

Commit 1dda146

Browse files
Sam Parteetylerhutcherson
andauthored
Doc update 0.0.5 (#81)
Documentation update for 0.0.5 Added - CLI notebook - permanent sidebar - version switching - installation guidelines - updated content --------- Co-authored-by: Tyler Hutcherson <[email protected]>
1 parent 14db1dc commit 1dda146

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+621
-56
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ redisvl.egg-info/
55
scratch
66
.DS_Store
77
*.csv
8-
wiki_schema.yaml
8+
wiki_schema.yaml
9+
docs/_build/

CONTRIBUTING.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,30 @@ helpful contributions that mean less work for you.
1515

1616
## Your First Contribution
1717

18-
Unsure where to begin contributing? You can start by looking through some of our issues [listed here](https://github.com/RedisVentures/data-loader/issues).
18+
Unsure where to begin contributing? You can start by looking through some of our issues [listed here](https://github.com/RedisVentures/redisvl/issues).
1919

2020
## Getting Started
2121

2222
Here's how to get started with your code contribution:
2323

2424
1. Create your own fork of this repo
25-
2. Apply the changes in your fork
26-
3. _We're still working on a development environment setup -- so stay tuned_
27-
4. If you like the change and think the project could use it, send a
25+
2. Set up your developer environment
26+
2. Apply the changes in your forked codebase / environment
27+
4. If you like the change and think the project could use it, send us a
2828
pull request.
2929

30+
### Dev Environment
31+
There is a provided `requirements.txt` and `requirements-dev.txt` file you can use to install required libraries with `pip` into your virtual environment.
32+
3033
### Docker Tips
3134

32-
>COMING SOON
35+
Make sure to have [Redis](https://redis.io) accessible with Search & Query features enabled on [Redis Cloud](https://redis.com/try-free) or locally in docker with [Redis Stack](https://redis.io/docs/getting-started/install-stack/docker/):
36+
37+
```bash
38+
docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
39+
```
40+
41+
This will also spin up the [Redis Insight GUI](https://redis.com/redis-enterprise/redis-insight/) at `http://localhost:8001`.
3342

3443
## How to Report a Bug
3544

@@ -55,7 +64,7 @@ issue, so if you're unsure, just email us.
5564
When filing an issue, make sure to answer these five questions:
5665

5766
1. What version of python are you using?
58-
2. What version of redis are you using?
67+
2. What version of `redis` and `redisvl` are you using?
5968
3. What did you do?
6069
4. What did you expect to see?
6170
5. What did you see instead?

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ mypy:
6565
docs:
6666
@cd docs; make html
6767

68+
# help: servedocs - Serve project documentation
69+
.PHONY: servedocs
70+
servedocs:
71+
@cd docs/_build/html/; python -m http.server
72+
6873
# help:
6974
# help: Test
7075
# help: -------
@@ -89,3 +94,9 @@ test-cov:
8994
cov:
9095
@coverage html
9196
@echo if data was present, coverage report is in ./htmlcov/index.html
97+
98+
99+
# help: test-notebooks - Run all notebooks
100+
.PHONY: test-notebooks
101+
test-notebooks:
102+
@cd docs/ && treon -v

README.md

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ RedisVL has a host of powerful features designed to streamline your vector datab
5151
- **Semantic Caching**: `LLMCache` is a semantic caching interface built directly into RedisVL. It allows for the caching of generated output from LLMs like GPT-3 and others. As semantic search is used to check the cache, a threshold can be set to determine if the cached result is relevant enough to be returned. If not, the model is called and the result is cached for future use. This can increase the QPS and reduce the cost of using LLM models in production.
5252

5353

54-
## 😊 Quick Start
54+
## Installation
5555

5656
Please note that this library is still under heavy development, and while you can quickly try RedisVL and deploy it in a production environment, the API may be subject to change at any time.
5757

@@ -81,7 +81,7 @@ This will also spin up the [Redis Insight GUI](https://redis.com/redis-enterpris
8181

8282
### Index Management
8383

84-
Indices can be defined through yaml specification that corresponds directly to the RediSearch field names and arguments in redis-py
84+
Indices can be defined through yaml specification, or json, that correspond directly to the Redis index, field names and arguments in `redis-py`. Take this example `idx.yaml` file:
8585

8686
```yaml
8787
index:
@@ -105,7 +105,7 @@ fields:
105105
distance_metric: cosine
106106
```
107107
108-
This would correspond to a dataset that looked something like
108+
This would correspond to a dataset that looked something like:
109109
110110
| user | age | job | credit_score | user_embedding |
111111
|-------|-----|------------|--------------|-----------------------------------|
@@ -114,14 +114,14 @@ This would correspond to a dataset that looked something like
114114
| joe | 3 | dentist | medium | \x3f\xab\xcc?\xab\xcc?@ |
115115
116116
117-
With the schema, the RedisVL library can be used to create, load vectors and perform vector searches
117+
With the YAML schema, the RedisVL library can be used to create the index, load vectors and perform vector searches:
118118
```python
119119

120120
from redisvl.index import SearchIndex
121121
from redisvl.query import VectorQuery
122122

123-
# initialize the index and connect to Redis
124-
index = SearchIndex.from_dict(schema)
123+
# initialize the index and connect to local Redis
124+
index = SearchIndex.from_schema("idx.yaml")
125125
index.connect("redis://localhost:6379")
126126

127127
# create the index in Redis
@@ -140,9 +140,9 @@ results = index.query(query)
140140

141141
```
142142

143-
### Flexible Querying
143+
### Redis Filter Expressions
144144

145-
RedisVL supports a variety of filter types, including tag, numeric, geographic, and full text search to create filter expressions. Filter expressions can be used to create hybrid queries which allow you to combine multiple query types (i.e. text and vector search) into a single query.
145+
RedisVL supports a variety of filter types, including tag, numeric, geographic, and full text search to create *Filter Expressions*. Filter expressions can be used to create hybrid queries which allow you to combine multiple complex data types (i.e. text and vector search) into a single query.
146146

147147
```python
148148
from redisvl.index import SearchIndex
@@ -174,6 +174,40 @@ results = index.query(query)
174174

175175
```
176176

177+
### Interoperability with core Redis Clients
178+
The purpose of RedisVL is **NOT** to fully replace your usage of the trusted Redis client libraries. It's simply here to make your life easier getting started and building generative AI applications on top of Redis. With that in mind, the RedisVL query interface and filter expressions can be ported and used with clients like `redis-py`.
179+
180+
Take the example filter expression from above:
181+
```python
182+
print(str(filter_expression))
183+
```
184+
185+
This prints the RediSearch hybrid filter expression:
186+
```
187+
'(((@user:{Sam} @age:[(10 +inf]) @location:[37.774900 -122.419400 10 km]) @job:enginee*)'
188+
```
189+
190+
Take the fully formed vector query from above:
191+
```python
192+
print(str(query))
193+
```
194+
195+
This prints the full RediSearch query, including hybrid filters and VSS:
196+
```
197+
'(((@user:{Sam} @age:[(10 +inf]) @location:[37.774900 -122.419400 10 km]) @job:enginee*)=>[KNN 3 @user_embedding $vector AS vector_distance] RETURN 5 user age job credit_score vector_distance SORTBY vector_distance ASC DIALECT 2 LIMIT 0 3'
198+
```
199+
200+
> Both of these query strings and expressions can be used with the core RediSearch API.
201+
202+
For example, use the RedisVL `query` object with the standard `redis-py` client:
203+
```python
204+
import redis
205+
206+
r = redis.Redis.from_url("redis://localhost:6379")
207+
208+
results = r.ft("user_index").search(query.query, query.params)
209+
```
210+
177211
### Semantic cache
178212

179213
The ``LLMCache`` Interface in RedisVL can be used as follows.
@@ -193,11 +227,17 @@ cache.check("What is the capital of France?")
193227
# store a result for a given query
194228
cache.store("What is the capital of France?", "Paris")
195229

196-
# Cache will now have the query
230+
# cache will now have the query
197231
cache.check("What is the capital of France?")
198232
["Paris"]
199233

200-
# Cache will still return the result if the query is similar enough
201-
cache.check("What really is the capital of France?")
234+
# cache will still return the result if the query is similar enough
235+
cache.check("Question -- What really is the capital of France?")
202236
["Paris"]
203237
```
238+
<<<<<<< HEAD
239+
=======
240+
241+
## Contributing
242+
Please help us by contributing PRs or opening GitHub issues for desired behaviors or discovered bugs. [Read more about how to contribute to RedisVL!](CONTRIBUTING.md)
243+
>>>>>>> 2ef8e43 (update contributing and reade)

docs/_static/concept-images/Chains.svg

Lines changed: 16 additions & 0 deletions
Loading
Loading
Loading
59.2 KB
Loading
89.3 KB
Loading
78.2 KB
Loading

0 commit comments

Comments
 (0)