Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 47 additions & 50 deletions content/integrate/redisvl/api/searchindex.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: integration

## SearchIndex

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

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

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

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

# create the index
index.create(overwrite=True)
Expand All @@ -49,7 +48,7 @@ kwargs.
instantiated redis client.
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
connect to.
* **connection_args** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
* **connection_kwargs** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
args.

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

* **Parameters:**
**redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
connect to. If not provided, the method defaults to using the
REDIS_URL environment variable.
connect to.
* **Raises:**
* **redis.exceptions.ConnectionError** – If the connection to the Redis
server fails.
* **ValueError** – If the Redis URL is not provided nor accessible
through the REDIS_URL environment variable.
* **ModuleNotFoundError** – If required Redis modules are not installed.

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

#### `expire_keys(keys, ttl)`

Set the expiration time for a specific entry or entries in Redis.

* **Parameters:**
* **keys** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The entry ID or IDs to set the expiration for.
* **ttl** (*int*) – The time-to-live in seconds.
* **Return type:**
int | *List*[int]

#### `fetch(id)`

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

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

Expand Down Expand Up @@ -438,7 +450,7 @@ hash or json.

## AsyncSearchIndex

### `class AsyncSearchIndex(schema, **kwargs)`
### `class AsyncSearchIndex(schema, *, redis_url=None, redis_client=None, connection_kwargs=None, **kwargs)`

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

# initialize the index object with schema from file
index = AsyncSearchIndex.from_yaml("schemas/schema.yaml")
await index.connect(redis_url="redis://localhost:6379")
index = AsyncSearchIndex.from_yaml(
"schemas/schema.yaml",
redis_url="redis://localhost:6379"
)

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

* **Parameters:**
* **schema** ([*IndexSchema*]({{< relref "schema/#indexschema" >}})) – Index schema object.
* **connection_args** (*Dict* *[* *str* *,* *Any* *]* *,* *optional*) – Redis client connection
* **redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
connect to.
* **redis_client** (*Optional* *[* *aredis.Redis* *]*) – An
instantiated redis client.
* **connection_kwargs** (*Optional* *[* *Dict* *[* *str* *,* *Any* *]* *]*) – Redis client connection
args.

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

#### `async connect(redis_url=None, **kwargs)`

Connect to a Redis instance using the provided redis_url, falling
back to the REDIS_URL environment variable (if available).
#### `connect(redis_url=None, **kwargs)`

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

* **Parameters:**
**redis_url** (*Optional* *[* *str* *]* *,* *optional*) – The URL of the Redis server to
connect to. If not provided, the method defaults to using the
REDIS_URL environment variable.
* **Raises:**
* **redis.exceptions.ConnectionError** – If the connection to the Redis
server fails.
* **ValueError** – If the Redis URL is not provided nor accessible
through the REDIS_URL environment variable.

```python
index.connect(redis_url="redis://localhost:6379")
```
**redis_url** (*str* *|* *None*)

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

Expand Down Expand Up @@ -553,9 +556,9 @@ Delete the search index.
* **Raises:**
**redis.exceptions.ResponseError** – If the index does not exist.

#### `disconnect()`
#### `async disconnect()`

Disconnect and cleanup the underlying async redis connection.
Disconnect from the Redis database.

#### `async drop_keys(keys)`

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

#### `async expire_keys(keys, ttl)`

Set the expiration time for a specific entry or entries in Redis.

* **Parameters:**
* **keys** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The entry ID or IDs to set the expiration for.
* **ttl** (*int*) – The time-to-live in seconds.
* **Return type:**
int | *List*[int]

#### `async fetch(id)`

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

#### `async set_client(redis_client)`
#### `set_client(redis_client)`

Manually set the Redis client to use with the search index.

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

* **Parameters:**
**redis_client** (*aredis.Redis*) – An Async Redis
client instance to be used for the connection.
* **Raises:**
**TypeError** – If the provided client is not valid.

```python
import redis.asyncio as aredis
from redisvl.index import AsyncSearchIndex

# async Redis client and index
client = aredis.Redis.from_url("redis://localhost:6379")
index = AsyncSearchIndex.from_yaml("schemas/schema.yaml")
await index.set_client(client)
```
**redis_client** (*Redis* *|* *Redis*)

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

Expand Down
2 changes: 1 addition & 1 deletion content/integrate/redisvl/overview/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Before running this notebook, be sure to
!rvl version
```

18:12:25 [RedisVL] INFO RedisVL version 0.3.9
16:19:10 [RedisVL] INFO RedisVL version 0.4.0


## Commands
Expand Down
94 changes: 49 additions & 45 deletions content/integrate/redisvl/user_guide/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,48 +11,52 @@ User guides provide helpful resources for using RedisVL and its different compon



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