Skip to content

Commit 69dd113

Browse files
authored
Update redisvl docs for redisvl 0.4.1 (#1317)
* Update redisvl docs for redisvl 0.4.1
1 parent 909d2a3 commit 69dd113

File tree

7 files changed

+496
-212
lines changed

7 files changed

+496
-212
lines changed

content/integrate/redisvl/api/searchindex.md

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type: integration
1414

1515
## SearchIndex
1616

17-
### `class SearchIndex(schema, redis_client=None, redis_url=None, connection_args={}, **kwargs)`
17+
### `class SearchIndex(schema, redis_client=None, redis_url=None, connection_kwargs=None, **kwargs)`
1818

1919
A search index class for interacting with Redis as a vector database.
2020

@@ -26,8 +26,7 @@ settings and field configurations.
2626
from redisvl.index import SearchIndex
2727

2828
# initialize the index object with schema from file
29-
index = SearchIndex.from_yaml("schemas/schema.yaml")
30-
index.connect(redis_url="redis://localhost:6379")
29+
index = SearchIndex.from_yaml("schemas/schema.yaml", redis_url="redis://localhost:6379")
3130

3231
# create the index
3332
index.create(overwrite=True)
@@ -49,7 +48,7 @@ kwargs.
4948
instantiated redis client.
5049
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
5150
connect to.
52-
* **connection_args** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
51+
* **connection_kwargs** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
5352
args.
5453

5554
#### `aggregate(*args, **kwargs)`
@@ -85,13 +84,13 @@ extra options specific to the Redis connection.
8584

8685
* **Parameters:**
8786
**redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
88-
connect to. If not provided, the method defaults to using the
89-
REDIS_URL environment variable.
87+
connect to.
9088
* **Raises:**
9189
* **redis.exceptions.ConnectionError** – If the connection to the Redis
9290
server fails.
9391
* **ValueError** – If the Redis URL is not provided nor accessible
9492
through the REDIS_URL environment variable.
93+
* **ModuleNotFoundError** – If required Redis modules are not installed.
9594

9695
```python
9796
index.connect(redis_url="redis://localhost:6379")
@@ -158,6 +157,16 @@ Check if the index exists in Redis.
158157
* **Return type:**
159158
bool
160159

160+
#### `expire_keys(keys, ttl)`
161+
162+
Set the expiration time for a specific entry or entries in Redis.
163+
164+
* **Parameters:**
165+
* **keys** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The entry ID or IDs to set the expiration for.
166+
* **ttl** (*int*) – The time-to-live in seconds.
167+
* **Return type:**
168+
int | *List*[int]
169+
161170
#### `fetch(id)`
162171

163172
Fetch an object from Redis by id.
@@ -210,6 +219,9 @@ Initialize from an existing search index in Redis by index name.
210219
instantiated redis client.
211220
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
212221
connect to.
222+
* **Raises:**
223+
* **ValueError** – If redis_url or redis_client is not provided.
224+
* **RedisModuleVersionError** – If required Redis modules are not installed.
213225

214226
#### `classmethod from_yaml(schema_path, **kwargs)`
215227

@@ -438,7 +450,7 @@ hash or json.
438450

439451
## AsyncSearchIndex
440452

441-
### `class AsyncSearchIndex(schema, **kwargs)`
453+
### `class AsyncSearchIndex(schema, *, redis_url=None, redis_client=None, connection_kwargs=None, **kwargs)`
442454

443455
A search index class for interacting with Redis as a vector database in
444456
async-mode.
@@ -451,8 +463,10 @@ various settings and field configurations.
451463
from redisvl.index import AsyncSearchIndex
452464

453465
# initialize the index object with schema from file
454-
index = AsyncSearchIndex.from_yaml("schemas/schema.yaml")
455-
await index.connect(redis_url="redis://localhost:6379")
466+
index = AsyncSearchIndex.from_yaml(
467+
"schemas/schema.yaml",
468+
redis_url="redis://localhost:6379"
469+
)
456470

457471
# create the index
458472
await index.create(overwrite=True)
@@ -468,7 +482,11 @@ Initialize the RedisVL async search index with a schema.
468482

469483
* **Parameters:**
470484
* **schema** ([*IndexSchema*]({{< relref "schema/#indexschema" >}})) – Index schema object.
471-
* **connection_args** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
485+
* **redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
486+
connect to.
487+
* **redis_client** (*Optional* *[* *aredis.Redis* *]*) – An
488+
instantiated redis client.
489+
* **connection_kwargs** (*Optional* *[* *Dict* *[* *str* *,* *Any* *]* *]*) – Redis client connection
472490
args.
473491

474492
#### `async aggregate(*args, **kwargs)`
@@ -494,27 +512,12 @@ available and in-place for future insertions or updates.
494512
* **Return type:**
495513
int
496514

497-
#### `async connect(redis_url=None, **kwargs)`
498-
499-
Connect to a Redis instance using the provided redis_url, falling
500-
back to the REDIS_URL environment variable (if available).
515+
#### `connect(redis_url=None, **kwargs)`
501516

502-
Note: Additional keyword arguments (\*\*kwargs) can be used to provide
503-
extra options specific to the Redis connection.
517+
[DEPRECATED] Connect to a Redis instance. Use connection parameters in \_\_init_\_.
504518

505519
* **Parameters:**
506-
**redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
507-
connect to. If not provided, the method defaults to using the
508-
REDIS_URL environment variable.
509-
* **Raises:**
510-
* **redis.exceptions.ConnectionError** – If the connection to the Redis
511-
server fails.
512-
* **ValueError** – If the Redis URL is not provided nor accessible
513-
through the REDIS_URL environment variable.
514-
515-
```python
516-
index.connect(redis_url="redis://localhost:6379")
517-
```
520+
**redis_url** (*str* *|* *None*)
518521

519522
#### `async create(overwrite=False, drop=False)`
520523

@@ -553,9 +556,9 @@ Delete the search index.
553556
* **Raises:**
554557
**redis.exceptions.ResponseError** – If the index does not exist.
555558

556-
#### `disconnect()`
559+
#### `async disconnect()`
557560

558-
Disconnect and cleanup the underlying async redis connection.
561+
Disconnect from the Redis database.
559562

560563
#### `async drop_keys(keys)`
561564

@@ -577,6 +580,16 @@ Check if the index exists in Redis.
577580
* **Return type:**
578581
bool
579582

583+
#### `async expire_keys(keys, ttl)`
584+
585+
Set the expiration time for a specific entry or entries in Redis.
586+
587+
* **Parameters:**
588+
* **keys** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The entry ID or IDs to set the expiration for.
589+
* **ttl** (*int*) – The time-to-live in seconds.
590+
* **Return type:**
591+
int | *List*[int]
592+
580593
#### `async fetch(id)`
581594

582595
Asynchronously etch an object from Redis by id. The id is typically
@@ -805,29 +818,13 @@ to the redis-py ft.search() method.
805818
* **Return type:**
806819
Result
807820

808-
#### `async set_client(redis_client)`
821+
#### `set_client(redis_client)`
809822

810-
Manually set the Redis client to use with the search index.
811-
812-
This method configures the search index to use a specific
813-
Async Redis client. It is useful for cases where an external,
814-
custom-configured client is preferred instead of creating a new one.
823+
[DEPRECATED] Manually set the Redis client to use with the search index.
824+
This method is deprecated; please provide connection parameters in \_\_init_\_.
815825

816826
* **Parameters:**
817-
**redis_client** (*aredis.Redis*) – An Async Redis
818-
client instance to be used for the connection.
819-
* **Raises:**
820-
**TypeError** – If the provided client is not valid.
821-
822-
```python
823-
import redis.asyncio as aredis
824-
from redisvl.index import AsyncSearchIndex
825-
826-
# async Redis client and index
827-
client = aredis.Redis.from_url("redis://localhost:6379")
828-
index = AsyncSearchIndex.from_yaml("schemas/schema.yaml")
829-
await index.set_client(client)
830-
```
827+
**redis_client** (*Redis* *|* *Redis*)
831828

832829
#### `property client: Redis | None`
833830

content/integrate/redisvl/overview/cli.md

Lines changed: 1 addition & 1 deletion
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-
18:12:25 [RedisVL] INFO RedisVL version 0.3.9
22+
16:19:10 [RedisVL] INFO RedisVL version 0.4.0
2323

2424

2525
## Commands

content/integrate/redisvl/user_guide/_index.md

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,52 @@ User guides provide helpful resources for using RedisVL and its different compon
1111

1212

1313

14-
* [Getting Started with RedisVL](01_getting_started/)
15-
* [Define an `IndexSchema`](01_getting_started/#define-an-indexschema)
16-
* [Sample Dataset Preparation](01_getting_started/#sample-dataset-preparation)
17-
* [Create a `SearchIndex`](01_getting_started/#create-a-searchindex)
18-
* [Inspect with the `rvl` CLI](01_getting_started/#inspect-with-the-rvl-cli)
19-
* [Load Data to `SearchIndex`](01_getting_started/#load-data-to-searchindex)
20-
* [Creating `VectorQuery` Objects](01_getting_started/#creating-vectorquery-objects)
21-
* [Using an Asynchronous Redis Client](01_getting_started/#using-an-asynchronous-redis-client)
22-
* [Updating a schema](01_getting_started/#updating-a-schema)
23-
* [Check Index Stats](01_getting_started/#check-index-stats)
24-
* [Cleanup](01_getting_started/#cleanup)
25-
* [Querying with RedisVL](02_hybrid_queries/)
26-
* [Hybrid Queries](02_hybrid_queries/#hybrid-queries)
27-
* [Combining Filters](02_hybrid_queries/#combining-filters)
28-
* [Non-vector Queries](02_hybrid_queries/#non-vector-queries)
29-
* [Count Queries](02_hybrid_queries/#count-queries)
30-
* [Range Queries](02_hybrid_queries/#range-queries)
31-
* [Advanced Query Modifiers](02_hybrid_queries/#advanced-query-modifiers)
32-
* [Semantic Caching for LLMs](03_llmcache/)
33-
* [Initializing `SemanticCache`](03_llmcache/#initializing-semanticcache)
34-
* [Basic Cache Usage](03_llmcache/#basic-cache-usage)
35-
* [Customize the Distance Threshhold](03_llmcache/#customize-the-distance-threshhold)
36-
* [Utilize TTL](03_llmcache/#utilize-ttl)
37-
* [Simple Performance Testing](03_llmcache/#simple-performance-testing)
38-
* [Cache Access Controls, Tags & Filters](03_llmcache/#cache-access-controls-tags-filters)
39-
* [Vectorizers](04_vectorizers/)
40-
* [Creating Text Embeddings](04_vectorizers/#creating-text-embeddings)
41-
* [Search with Provider Embeddings](04_vectorizers/#search-with-provider-embeddings)
42-
* [Selecting your float data type](04_vectorizers/#selecting-your-float-data-type)
43-
* [Hash vs JSON Storage](05_hash_vs_json/)
44-
* [Hash or JSON – how to choose?](05_hash_vs_json/#hash-or-json-how-to-choose)
45-
* [Cleanup](05_hash_vs_json/#cleanup)
46-
* [Rerankers](06_rerankers/)
47-
* [Simple Reranking](06_rerankers/#simple-reranking)
48-
* [LLM Session Memory](07_session_manager/)
49-
* [Managing multiple users and conversations](07_session_manager/#managing-multiple-users-and-conversations)
50-
* [Semantic conversation memory](07_session_manager/#semantic-conversation-memory)
51-
* [Conversation control](07_session_manager/#conversation-control)
52-
* [Semantic Routing](08_semantic_router/)
53-
* [Define the Routes](08_semantic_router/#define-the-routes)
54-
* [Initialize the SemanticRouter](08_semantic_router/#initialize-the-semanticrouter)
55-
* [Simple routing](08_semantic_router/#simple-routing)
56-
* [Update the routing config](08_semantic_router/#update-the-routing-config)
57-
* [Router serialization](08_semantic_router/#router-serialization)
58-
* [Clean up the router](08_semantic_router/#clean-up-the-router)
14+
* [Getting Started with RedisVL](getting_started/)
15+
* [Define an `IndexSchema`](getting_started/#define-an-indexschema)
16+
* [Sample Dataset Preparation](getting_started/#sample-dataset-preparation)
17+
* [Create a `SearchIndex`](getting_started/#create-a-searchindex)
18+
* [Inspect with the `rvl` CLI](getting_started/#inspect-with-the-rvl-cli)
19+
* [Load Data to `SearchIndex`](getting_started/#load-data-to-searchindex)
20+
* [Creating `VectorQuery` Objects](getting_started/#creating-vectorquery-objects)
21+
* [Using an Asynchronous Redis Client](getting_started/#using-an-asynchronous-redis-client)
22+
* [Updating a schema](getting_started/#updating-a-schema)
23+
* [Check Index Stats](getting_started/#check-index-stats)
24+
* [Cleanup](getting_started/#cleanup)
25+
* [Querying with RedisVL](hybrid_queries/)
26+
* [Hybrid Queries](hybrid_queries/#hybrid-queries)
27+
* [Combining Filters](hybrid_queries/#combining-filters)
28+
* [Non-vector Queries](hybrid_queries/#non-vector-queries)
29+
* [Count Queries](hybrid_queries/#count-queries)
30+
* [Range Queries](hybrid_queries/#range-queries)
31+
* [Advanced Query Modifiers](hybrid_queries/#advanced-query-modifiers)
32+
* [Semantic Caching for LLMs](llmcache/)
33+
* [Initializing `SemanticCache`](llmcache/#initializing-semanticcache)
34+
* [Basic Cache Usage](llmcache/#basic-cache-usage)
35+
* [Customize the Distance Threshhold](llmcache/#customize-the-distance-threshhold)
36+
* [Utilize TTL](llmcache/#utilize-ttl)
37+
* [Simple Performance Testing](llmcache/#simple-performance-testing)
38+
* [Cache Access Controls, Tags & Filters](llmcache/#cache-access-controls-tags-filters)
39+
* [Vectorizers](vectorizers/)
40+
* [Creating Text Embeddings](vectorizers/#creating-text-embeddings)
41+
* [Search with Provider Embeddings](vectorizers/#search-with-provider-embeddings)
42+
* [Selecting your float data type](vectorizers/#selecting-your-float-data-type)
43+
* [Hash vs JSON Storage](hash_vs_json/)
44+
* [Hash or JSON – how to choose?](hash_vs_json/#hash-or-json-how-to-choose)
45+
* [Cleanup](hash_vs_json/#cleanup)
46+
* [Working with nested data in JSON](hash_vs_json/#working-with-nested-data-in-json)
47+
* [Full JSON Path support](hash_vs_json/#full-json-path-support)
48+
* [As an example:](hash_vs_json/#as-an-example)
49+
* [Cleanup](hash_vs_json/#id1)
50+
* [Rerankers](rerankers/)
51+
* [Simple Reranking](rerankers/#simple-reranking)
52+
* [LLM Session Memory](session_manager/)
53+
* [Managing multiple users and conversations](session_manager/#managing-multiple-users-and-conversations)
54+
* [Semantic conversation memory](session_manager/#semantic-conversation-memory)
55+
* [Conversation control](session_manager/#conversation-control)
56+
* [Semantic Routing](semantic_router/)
57+
* [Define the Routes](semantic_router/#define-the-routes)
58+
* [Initialize the SemanticRouter](semantic_router/#initialize-the-semanticrouter)
59+
* [Simple routing](semantic_router/#simple-routing)
60+
* [Update the routing config](semantic_router/#update-the-routing-config)
61+
* [Router serialization](semantic_router/#router-serialization)
62+
* [Clean up the router](semantic_router/#clean-up-the-router)

0 commit comments

Comments
 (0)