Skip to content

Commit ba526d5

Browse files
Update for redisvl 0.7.0
1 parent dbec1c8 commit ba526d5

File tree

13 files changed

+1109
-1067
lines changed

13 files changed

+1109
-1067
lines changed

content/integrate/redisvl/api/cache.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ The default TTL, in seconds, for entries in the cache.
407407

408408
<a id="embeddings-cache-api"></a>
409409

410-
### `class EmbeddingsCache(name='embedcache', ttl=None, redis_client=None, redis_url='redis://localhost:6379', connection_kwargs={})`
410+
### `class EmbeddingsCache(name='embedcache', ttl=None, redis_client=None, async_redis_client=None, redis_url='redis://localhost:6379', connection_kwargs={})`
411411

412412
Bases: `BaseCache`
413413

@@ -418,9 +418,10 @@ Initialize an embeddings cache.
418418
* **Parameters:**
419419
* **name** (*str*) – The name of the cache. Defaults to “embedcache”.
420420
* **ttl** (*Optional* *[* *int* *]*) – The time-to-live for cached embeddings. Defaults to None.
421-
* **redis_client** (*Optional* *[* *Redis* *]*) – Redis client instance. Defaults to None.
421+
* **redis_client** (*Optional* *[* *SyncRedisClient* *]*) – Redis client instance. Defaults to None.
422422
* **redis_url** (*str*) – Redis URL for connection. Defaults to “redis://localhost:6379”.
423423
* **connection_kwargs** (*Dict* *[* *str* *,* *Any* *]*) – Redis connection arguments. Defaults to {}.
424+
* **async_redis_client** (*Redis* *|* *RedisCluster* *|* *None*)
424425
* **Raises:**
425426
**ValueError** – If vector dimensions are invalid
426427

content/integrate/redisvl/api/query.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ Add fields to return fields.
173173
Use a different scoring function to evaluate document relevance.
174174
Default is TFIDF.
175175

176+
Since Redis 8.0 default was changed to BM25STD.
177+
176178
* **Parameters:**
177179
**scorer** (*str*) – The scoring function to use
178180
(e.g. TFIDF.DOCNORM or BM25)
@@ -487,6 +489,8 @@ Add fields to return fields.
487489
Use a different scoring function to evaluate document relevance.
488490
Default is TFIDF.
489491

492+
Since Redis 8.0 default was changed to BM25STD.
493+
490494
* **Parameters:**
491495
**scorer** (*str*) – The scoring function to use
492496
(e.g. TFIDF.DOCNORM or BM25)
@@ -1069,6 +1073,8 @@ Add fields to return fields.
10691073
Use a different scoring function to evaluate document relevance.
10701074
Default is TFIDF.
10711075

1076+
Since Redis 8.0 default was changed to BM25STD.
1077+
10721078
* **Parameters:**
10731079
**scorer** (*str*) – The scoring function to use
10741080
(e.g. TFIDF.DOCNORM or BM25)
@@ -1281,6 +1287,8 @@ Add fields to return fields.
12811287
Use a different scoring function to evaluate document relevance.
12821288
Default is TFIDF.
12831289

1290+
Since Redis 8.0 default was changed to BM25STD.
1291+
12841292
* **Parameters:**
12851293
**scorer** (*str*) – The scoring function to use
12861294
(e.g. TFIDF.DOCNORM or BM25)
@@ -1498,6 +1506,8 @@ Add fields to return fields.
14981506
Use a different scoring function to evaluate document relevance.
14991507
Default is TFIDF.
15001508

1509+
Since Redis 8.0 default was changed to BM25STD.
1510+
15011511
* **Parameters:**
15021512
**scorer** (*str*) – The scoring function to use
15031513
(e.g. TFIDF.DOCNORM or BM25)

content/integrate/redisvl/api/router.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Initialize the SemanticRouter.
2020
* **routes** (*List* *[*[Route](#route) *]*) – List of Route objects.
2121
* **vectorizer** (*BaseVectorizer* *,* *optional*) – The vectorizer used to embed route references. Defaults to default HFTextVectorizer.
2222
* **routing_config** ([RoutingConfig](#routingconfig) *,* *optional*) – Configuration for routing behavior. Defaults to the default RoutingConfig.
23-
* **redis_client** (*Optional* *[* *Redis* *]* *,* *optional*) – Redis client for connection. Defaults to None.
23+
* **redis_client** (*Optional* *[* *SyncRedisClient* *]* *,* *optional*) – Redis client for connection. Defaults to None.
2424
* **redis_url** (*str* *,* *optional*) – The redis url. Defaults to redis://localhost:6379.
2525
* **overwrite** (*bool* *,* *optional*) – Whether to overwrite existing index. Defaults to False.
2626
* **connection_kwargs** (*Dict* *[* *str* *,* *Any* *]*) – The connection arguments
@@ -98,7 +98,7 @@ Return SemanticRouter instance from existing index.
9898

9999
* **Parameters:**
100100
* **name** (*str*)
101-
* **redis_client** (*Redis* *|* *None*)
101+
* **redis_client** (*Redis* *|* *RedisCluster* *|* *None*)
102102
* **redis_url** (*str*)
103103
* **Return type:**
104104
[SemanticRouter](#semanticrouter)

content/integrate/redisvl/api/searchindex.md

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ kwargs.
4848

4949
* **Parameters:**
5050
* **schema** ([*IndexSchema*]({{< relref "schema/#indexschema" >}})) – Index schema object.
51-
* **redis_client** (*Optional* *[* *redis.Redis* *]*) – An
51+
* **redis_client** (*Optional* *[* *Redis* *]*) – An
5252
instantiated redis client.
5353
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
5454
connect to.
@@ -88,13 +88,13 @@ This method takes a list of queries and optionally query params and
8888
returns a list of Result objects for each query. Results are
8989
returned in the same order as the queries.
9090

91+
NOTE: Cluster users may need to incorporate hash tags into their query
92+
to avoid cross-slot operations.
93+
9194
* **Parameters:**
92-
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for. batch_size
93-
* **(* ***int** – The number of queries to search for at a time.
94-
Defaults to 10.
95-
* **optional****)** – The number of queries to search for at a time.
95+
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for.
96+
* **batch_size** (*int* *,* *optional*) – The number of queries to search for at a time.
9697
Defaults to 10.
97-
* **batch_size** (*int*)
9898
* **Returns:**
9999
The search results for each query.
100100
* **Return type:**
@@ -105,6 +105,10 @@ returned in the same order as the queries.
105105
Clear all keys in Redis associated with the index, leaving the index
106106
available and in-place for future insertions or updates.
107107

108+
NOTE: This method requires custom behavior for Redis Cluster because
109+
here, we can’t easily give control of the keys we’re clearing to the
110+
user so they can separate them based on hash tag.
111+
108112
* **Returns:**
109113
Count of records deleted from Redis.
110114
* **Return type:**
@@ -176,6 +180,10 @@ Remove documents from the index by their document IDs.
176180
This method converts document IDs to Redis keys automatically by applying
177181
the index’s key prefix and separator configuration.
178182

183+
NOTE: Cluster users will need to incorporate hash tags into their
184+
document IDs and only call this method with documents from a single hash
185+
tag at a time.
186+
179187
* **Parameters:**
180188
**ids** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The document ID or IDs to remove from the index.
181189
* **Returns:**
@@ -261,7 +269,7 @@ Initialize from an existing search index in Redis by index name.
261269

262270
* **Parameters:**
263271
* **name** (*str*) – Name of the search index in Redis.
264-
* **redis_client** (*Optional* *[* *redis.Redis* *]*) – An
272+
* **redis_client** (*Optional* *[* *Redis* *]*) – An
265273
instantiated redis client.
266274
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
267275
connect to.
@@ -436,12 +444,12 @@ Async Redis client. It is useful for cases where an external,
436444
custom-configured client is preferred instead of creating a new one.
437445

438446
* **Parameters:**
439-
**redis_client** (*redis.Redis*) – A Redis or Async Redis
447+
**redis_client** (*Redis*) – A Redis or Async Redis
440448
client instance to be used for the connection.
441449
* **Raises:**
442450
**TypeError** – If the provided client is not valid.
443451

444-
#### `property client: Redis | None`
452+
#### `property client: Redis | RedisCluster | None`
445453

446454
The underlying redis-py client object.
447455

@@ -503,7 +511,7 @@ Initialize the RedisVL async search index with a schema.
503511
* **schema** ([*IndexSchema*]({{< relref "schema/#indexschema" >}})) – Index schema object.
504512
* **redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
505513
connect to.
506-
* **redis_client** (*Optional* *[* *aredis.Redis* *]*) – An
514+
* **redis_client** (*Optional* *[* *AsyncRedis* *]*) – An
507515
instantiated redis client.
508516
* **connection_kwargs** (*Optional* *[* *Dict* *[* *str* *,* *Any* *]* *]*) – Redis client connection
509517
args.
@@ -535,28 +543,42 @@ Asynchronously execute a batch of queries and process results.
535543

536544
#### `async batch_search(queries, batch_size=10)`
537545

538-
Perform a search against the index for multiple queries.
546+
Asynchronously execute a batch of search queries.
547+
548+
This method takes a list of search queries and executes them in batches
549+
to improve performance when dealing with multiple queries.
539550

540-
This method takes a list of queries and returns a list of Result objects
541-
for each query. Results are returned in the same order as the queries.
551+
NOTE: Cluster users may need to incorporate hash tags into their query
552+
to avoid cross-slot operations.
542553

543554
* **Parameters:**
544-
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for. batch_size
545-
* **(* ***int** – The number of queries to search for at a time.
546-
Defaults to 10.
547-
* **optional****)** – The number of queries to search for at a time.
548-
Defaults to 10.
549-
* **batch_size** (*int*)
555+
* **queries** (*List* *[* *SearchParams* *]*) – A list of search queries to execute.
556+
Each query can be either a string or a tuple of (query, params).
557+
* **batch_size** (*int* *,* *optional*) – The number of queries to execute in each
558+
batch. Defaults to 10.
550559
* **Returns:**
551-
The search results for each query.
560+
A list of search results corresponding to each query.
552561
* **Return type:**
553562
List[Result]
554563

564+
```python
565+
queries = [
566+
"hello world",
567+
("goodbye world", {"num_results": 5}),
568+
]
569+
570+
results = await index.batch_search(queries)
571+
```
572+
555573
#### `async clear()`
556574

557575
Clear all keys in Redis associated with the index, leaving the index
558576
available and in-place for future insertions or updates.
559577

578+
NOTE: This method requires custom behavior for Redis Cluster because here,
579+
we can’t easily give control of the keys we’re clearing to the user so they
580+
can separate them based on hash tag.
581+
560582
* **Returns:**
561583
Count of records deleted from Redis.
562584
* **Return type:**
@@ -617,6 +639,10 @@ Remove documents from the index by their document IDs.
617639
This method converts document IDs to Redis keys automatically by applying
618640
the index’s key prefix and separator configuration.
619641

642+
NOTE: Cluster users will need to incorporate hash tags into their
643+
document IDs and only call this method with documents from a single hash
644+
tag at a time.
645+
620646
* **Parameters:**
621647
**ids** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The document ID or IDs to remove from the index.
622648
* **Returns:**
@@ -700,7 +726,7 @@ Initialize from an existing search index in Redis by index name.
700726

701727
* **Parameters:**
702728
* **name** (*str*) – Name of the search index in Redis.
703-
* **redis_client** (*Optional* *[* *redis.Redis* *]*) – An
729+
* **redis_client** (*Optional* *[* *Redis* *]*) – An
704730
instantiated redis client.
705731
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
706732
connect to.
@@ -872,11 +898,11 @@ results = await index.query(query)
872898

873899
#### `async search(*args, **kwargs)`
874900

875-
Perform a search on this index.
901+
Perform an async search against the index.
876902

877-
Wrapper around redis.search.Search that adds the index name
878-
to the search query and passes along the rest of the arguments
879-
to the redis-py ft.search() method.
903+
Wrapper around the search API that adds the index name
904+
to the query and passes along the rest of the arguments
905+
to the redis-py ft().search() method.
880906

881907
* **Returns:**
882908
Raw Redis search results.
@@ -889,9 +915,9 @@ to the redis-py ft.search() method.
889915
This method is deprecated; please provide connection parameters in \_\_init_\_.
890916

891917
* **Parameters:**
892-
**redis_client** (*Redis* *|* *Redis*)
918+
**redis_client** (*Redis* *|* *RedisCluster* *|* *Redis* *|* *RedisCluster*)
893919

894-
#### `property client: Redis | None`
920+
#### `property client: Redis | RedisCluster | None`
895921

896922
The underlying redis-py client object.
897923

content/integrate/redisvl/overview/cli.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Before running this notebook, be sure to
1919
!rvl version
2020
```
2121

22-
19:16:18 [RedisVL] INFO RedisVL version 0.5.2
22+
16:41:26 [RedisVL] INFO RedisVL version 0.7.0
2323

2424

2525
## Commands
@@ -74,7 +74,7 @@ fields:
7474
!rvl index create -s schema.yaml
7575
```
7676

77-
19:16:21 [RedisVL] INFO Index created successfully
77+
16:43:40 [RedisVL] INFO Index created successfully
7878

7979

8080

@@ -83,8 +83,8 @@ fields:
8383
!rvl index listall
8484
```
8585

86-
19:16:24 [RedisVL] INFO Indices:
87-
19:16:24 [RedisVL] INFO 1. vectorizers
86+
16:43:43 [RedisVL] INFO Indices:
87+
16:43:43 [RedisVL] INFO 1. vectorizers
8888

8989

9090

@@ -116,7 +116,7 @@ fields:
116116
!rvl index delete -i vectorizers
117117
```
118118

119-
19:16:29 [RedisVL] INFO Index deleted successfully
119+
16:43:50 [RedisVL] INFO Index deleted successfully
120120

121121

122122

@@ -125,7 +125,7 @@ fields:
125125
!rvl index listall
126126
```
127127

128-
19:16:32 [RedisVL] INFO Indices:
128+
16:43:53 [RedisVL] INFO Indices:
129129

130130

131131
## Stats
@@ -139,7 +139,7 @@ The ``rvl stats`` command will return some basic information about the index. Th
139139
!rvl index create -s schema.yaml
140140
```
141141

142-
19:16:35 [RedisVL] INFO Index created successfully
142+
16:43:55 [RedisVL] INFO Index created successfully
143143

144144

145145

@@ -148,8 +148,8 @@ The ``rvl stats`` command will return some basic information about the index. Th
148148
!rvl index listall
149149
```
150150

151-
19:16:38 [RedisVL] INFO Indices:
152-
19:16:38 [RedisVL] INFO 1. vectorizers
151+
16:43:58 [RedisVL] INFO Indices:
152+
16:43:58 [RedisVL] INFO 1. vectorizers
153153

154154

155155

@@ -206,8 +206,8 @@ By default rvl first checks if you have `REDIS_URL` environment variable defined
206206
!rvl index listall --host localhost --port 6379
207207
```
208208

209-
19:16:43 [RedisVL] INFO Indices:
210-
19:16:43 [RedisVL] INFO 1. vectorizers
209+
16:44:03 [RedisVL] INFO Indices:
210+
16:44:03 [RedisVL] INFO 1. vectorizers
211211

212212

213213
### Using SSL encription
@@ -220,13 +220,10 @@ You can similarly specify the username and password to construct the full Redis
220220
!rvl index listall --user jane_doe -a password123 --ssl
221221
```
222222

223-
19:16:46 [RedisVL] ERROR Error 8 connecting to rediss:6379. nodename nor servname provided, or not known.
224-
225-
226223

227224
```python
228225
!rvl index destroy -i vectorizers
229226
```
230227

231-
19:16:49 [RedisVL] INFO Index deleted successfully
228+
16:44:13 [RedisVL] INFO Index deleted successfully
232229

0 commit comments

Comments
 (0)