Skip to content

Commit 95c4677

Browse files
author
Sam Partee
authored
0.0.3 Documentation Update (#48)
1 parent 23f7e97 commit 95c4677

File tree

16 files changed

+496
-165
lines changed

16 files changed

+496
-165
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,41 @@ query = VectorQuery(
115115
return_fields=["user", "age", "job", "credit_score"],
116116
num_results=3,
117117
)
118-
results = index.search(query.query, query_params=query.params)
118+
results = index.query(query)
119+
120+
```
121+
122+
### Flexible Querying
123+
124+
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.
125+
126+
```python
127+
from redisvl.index import SearchIndex
128+
from redisvl.query import VectorQuery
129+
from redisvl.query.filter import Tag, Num, Geo, GeoRadius, Text
130+
131+
# exact tag match
132+
is_sam = Tag("user") == "Sam"
133+
134+
# numeric range
135+
is_over_10 = Num("age") > 10
136+
137+
# geographic radius
138+
works_in_sf = Geo("location") == GeoRadius(37.7749, -122.4194, 10)
139+
140+
# full text search with fuzzy match
141+
is_engineer = Text("job") % "enginee*"
142+
143+
filter_expression = is_sam & is_over_10 & works_in_sf & is_engineer
144+
145+
query = VectorQuery(
146+
vector=[0.1, 0.1, 0.5],
147+
vector_field_name="user_embedding",
148+
return_fields=["user", "age", "job", "credit_score"],
149+
num_results=3,
150+
filter_expression=filter_expression,
151+
)
152+
results = index.query(query)
119153

120154
```
121155

167 KB
Loading
516 KB
Loading

docs/_static/gallery.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Metadata to create our example gallery. This YAML file does two things:
2+
#
3+
# 1. Used by `generate_gallery_images.py` to take snapshots of each item and place an image in `gallery`.
4+
# 2. Used by our Gallery Grid directive to create the grid on our `examples/gallery.md` page.
5+
#
6+
# This file should only be modified by maintainer, contributors should add their project
7+
# to the list of `gallery.md`.
8+
9+
- title: Question and Answer with OpenAI
10+
website: https://www.redisvl.com/docs/html/examples/openai_qna.html
11+
img-bottom: ../_static/gallery-images/RedisOpenAI-QnA.png
12+
- title: LLM Recommender for Hotels
13+
website: https://github.com/RedisVentures/LLM-Recommender
14+
img-bottom: ../_static/gallery-images/hotel-recommender.png

docs/api/filter.rst

Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,73 +4,107 @@ Filter
44

55
.. _filter_api:
66

7-
TagFilter
8-
=========
7+
FilterExpression
8+
================
9+
10+
.. currentmodule:: redisvl.query.filter
911

12+
.. autoclass:: FilterExpression
1013

11-
.. currentmodule:: redisvl.query
14+
Tag
15+
===
16+
17+
.. currentmodule:: redisvl.query.filter
1218

1319
.. autosummary::
1420

15-
TagFilter.__init__
16-
TagFilter.to_string
21+
Tag.__init__
22+
Tag.__eq__
23+
Tag.__ne__
24+
Tag.__str__
1725

1826

19-
.. autoclass:: TagFilter
27+
.. autoclass:: Tag
2028
:show-inheritance:
2129
:members:
30+
:special-members:
2231
:inherited-members:
2332

2433

2534

26-
TextFilter
27-
==========
35+
Text
36+
====
2837

2938

30-
.. currentmodule:: redisvl.query
39+
.. currentmodule:: redisvl.query.filter
3140

3241
.. autosummary::
3342

34-
TextFilter.__init__
35-
TextFilter.to_string
43+
Text.__init__
44+
Text.__eq__
45+
Text.__ne__
46+
Text.__mod__
47+
Text.__str__
3648

3749

38-
.. autoclass:: TextFilter
50+
.. autoclass:: Text
3951
:show-inheritance:
4052
:members:
41-
:inherited-members:
53+
:special-members:
4254

4355

44-
NumericFilter
45-
=============
56+
Num
57+
===
4658

4759

48-
.. currentmodule:: redisvl.query
60+
.. currentmodule:: redisvl.query.filter
4961

5062
.. autosummary::
5163

52-
NumericFilter.__init__
53-
NumericFilter.to_string
64+
Num.__init__
65+
Num.__eq__
66+
Num.__ne__
67+
Num.__lt__
68+
Num.__le__
69+
Num.__gt__
70+
Num.__ge__
71+
Num.__str__
5472

5573

56-
.. autoclass:: NumericFilter
74+
.. autoclass:: Num
5775
:show-inheritance:
5876
:members:
59-
:inherited-members:
77+
:special-members:
6078

6179

62-
GeoFilter
63-
=========
80+
Geo
81+
===
6482

65-
.. currentmodule:: redisvl.query
83+
.. currentmodule:: redisvl.query.filter
6684

6785
.. autosummary::
6886

69-
GeoFilter.__init__
70-
GeoFilter.to_string
87+
Geo.__init__
88+
Geo.__eq__
89+
Geo.__ne__
90+
Geo.__str__
91+
92+
.. autoclass:: Geo
93+
:show-inheritance:
94+
:members:
95+
:special-members:
96+
97+
98+
GeoRadius
99+
=========
100+
101+
.. currentmodule:: redisvl.query.filter
102+
103+
.. autosummary::
71104

105+
GeoRadius.__init__
72106

73-
.. autoclass:: GeoFilter
107+
.. autoclass:: GeoRadius
74108
:show-inheritance:
75109
:members:
76-
:inherited-members:
110+
:special-members:

docs/api/vectorizer.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
*****
2+
**********
33
Vectorizer
4-
*****
4+
**********
55

66
HFTextVectorizer
7-
===========
7+
================
88

99
.. _hftextvectorizer_api:
1010

@@ -23,7 +23,7 @@ HFTextVectorizer
2323

2424

2525
OpenAITextVectorizer
26-
================
26+
====================
2727

2828
.. _openaitextvectorizer_api:
2929

docs/changelog.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@
9292
"alt_text": "RedisVL",
9393
},
9494
"use_edit_page_button": True,
95-
"show_toc_level": 1,
95+
"show_toc_level": 4,
96+
"show_nav_level": 3,
97+
"navigation_depth": 5,
9698
"navbar_align": "left", # [left, content, right] For testing that the navbar items align properly
9799
"secondary_sidebar_items": ["page-toc", "edit-this-page", "sourcelink"],
98100
"icon_links": [

docs/examples/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,20 @@ myst:
55
Examples for RedisVL users
66
---
77

8+
89
# Examples
910

11+
```{note}
12+
If you are using RedisVL, please consider adding your example to this page by
13+
opening a Pull Request on [GitHub](https://github.com/RedisVentures/RedisVl)
14+
```
15+
16+
```{gallery-grid} ../_static/gallery.yaml
17+
:grid-columns: "1 1 2 2"
18+
```
1019

1120
```{toctree}
21+
:hidden:
1222
1323
openai_qna
1424

docs/index.md

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,12 @@ to supercharge your application!
3131
link: "examples/index"
3232
```
3333

34-
## Concepts (Coming Soon)
35-
36-
Glossary of AI terminology and concepts related to vector databases.
37-
38-
39-
## User Guide
40-
41-
How to use RedisVL
42-
43-
```{toctree}
44-
:maxdepth: 2
45-
46-
user_guide/index
47-
```
48-
49-
50-
## Examples
51-
52-
Examples of RedisVL
53-
54-
```{toctree}
55-
:maxdepth: 2
56-
57-
examples/index
58-
```
59-
60-
61-
## API
62-
63-
The redisVL API
34+
## Table of Contents
6435

6536
```{toctree}
6637
:maxdepth: 2
6738
39+
User Guide <user_guide/index>
40+
Example Gallery <examples/index>
6841
API <api/index>
6942
```
70-
71-
72-
```{toctree}
73-
:hidden:
74-
75-
Changelog <https://github.com/RedisVentures/redisvl/releases>
76-
```

0 commit comments

Comments
 (0)