Skip to content

update for redisvl 0.7.0 #1646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions content/integrate/redisvl/api/cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ The default TTL, in seconds, for entries in the cache.

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

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

Bases: `BaseCache`

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

Expand Down
10 changes: 10 additions & 0 deletions content/integrate/redisvl/api/query.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ Add fields to return fields.
Use a different scoring function to evaluate document relevance.
Default is TFIDF.

Since Redis 8.0 default was changed to BM25STD.

* **Parameters:**
**scorer** (*str*) – The scoring function to use
(e.g. TFIDF.DOCNORM or BM25)
Expand Down Expand Up @@ -487,6 +489,8 @@ Add fields to return fields.
Use a different scoring function to evaluate document relevance.
Default is TFIDF.

Since Redis 8.0 default was changed to BM25STD.

* **Parameters:**
**scorer** (*str*) – The scoring function to use
(e.g. TFIDF.DOCNORM or BM25)
Expand Down Expand Up @@ -1069,6 +1073,8 @@ Add fields to return fields.
Use a different scoring function to evaluate document relevance.
Default is TFIDF.

Since Redis 8.0 default was changed to BM25STD.

* **Parameters:**
**scorer** (*str*) – The scoring function to use
(e.g. TFIDF.DOCNORM or BM25)
Expand Down Expand Up @@ -1281,6 +1287,8 @@ Add fields to return fields.
Use a different scoring function to evaluate document relevance.
Default is TFIDF.

Since Redis 8.0 default was changed to BM25STD.

* **Parameters:**
**scorer** (*str*) – The scoring function to use
(e.g. TFIDF.DOCNORM or BM25)
Expand Down Expand Up @@ -1498,6 +1506,8 @@ Add fields to return fields.
Use a different scoring function to evaluate document relevance.
Default is TFIDF.

Since Redis 8.0 default was changed to BM25STD.

* **Parameters:**
**scorer** (*str*) – The scoring function to use
(e.g. TFIDF.DOCNORM or BM25)
Expand Down
4 changes: 2 additions & 2 deletions content/integrate/redisvl/api/router.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Initialize the SemanticRouter.
* **routes** (*List* *[*[Route](#route) *]*) – List of Route objects.
* **vectorizer** (*BaseVectorizer* *,* *optional*) – The vectorizer used to embed route references. Defaults to default HFTextVectorizer.
* **routing_config** ([RoutingConfig](#routingconfig) *,* *optional*) – Configuration for routing behavior. Defaults to the default RoutingConfig.
* **redis_client** (*Optional* *[* *Redis* *]* *,* *optional*) – Redis client for connection. Defaults to None.
* **redis_client** (*Optional* *[* *SyncRedisClient* *]* *,* *optional*) – Redis client for connection. Defaults to None.
* **redis_url** (*str* *,* *optional*) – The redis url. Defaults to redis://localhost:6379.
* **overwrite** (*bool* *,* *optional*) – Whether to overwrite existing index. Defaults to False.
* **connection_kwargs** (*Dict* *[* *str* *,* *Any* *]*) – The connection arguments
Expand Down Expand Up @@ -98,7 +98,7 @@ Return SemanticRouter instance from existing index.

* **Parameters:**
* **name** (*str*)
* **redis_client** (*Redis* *|* *None*)
* **redis_client** (*Redis* *|* *RedisCluster* *|* *None*)
* **redis_url** (*str*)
* **Return type:**
[SemanticRouter](#semanticrouter)
Expand Down
80 changes: 53 additions & 27 deletions content/integrate/redisvl/api/searchindex.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ kwargs.

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

NOTE: Cluster users may need to incorporate hash tags into their query
to avoid cross-slot operations.

* **Parameters:**
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for. batch_size
* **(* ***int** – The number of queries to search for at a time.
Defaults to 10.
* **optional****)** – The number of queries to search for at a time.
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for.
* **batch_size** (*int* *,* *optional*) – The number of queries to search for at a time.
Defaults to 10.
* **batch_size** (*int*)
* **Returns:**
The search results for each query.
* **Return type:**
Expand All @@ -105,6 +105,10 @@ returned in the same order as the queries.
Clear all keys in Redis associated with the index, leaving the index
available and in-place for future insertions or updates.

NOTE: This method requires custom behavior for Redis Cluster because
here, we can’t easily give control of the keys we’re clearing to the
user so they can separate them based on hash tag.

* **Returns:**
Count of records deleted from Redis.
* **Return type:**
Expand Down Expand Up @@ -176,6 +180,10 @@ Remove documents from the index by their document IDs.
This method converts document IDs to Redis keys automatically by applying
the index’s key prefix and separator configuration.

NOTE: Cluster users will need to incorporate hash tags into their
document IDs and only call this method with documents from a single hash
tag at a time.

* **Parameters:**
**ids** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The document ID or IDs to remove from the index.
* **Returns:**
Expand Down Expand Up @@ -261,7 +269,7 @@ Initialize from an existing search index in Redis by index name.

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

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

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

The underlying redis-py client object.

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

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

Perform a search against the index for multiple queries.
Asynchronously execute a batch of search queries.

This method takes a list of search queries and executes them in batches
to improve performance when dealing with multiple queries.

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

* **Parameters:**
* **queries** (*List* *[* *SearchParams* *]*) – The queries to search for. batch_size
* **(* ***int** – The number of queries to search for at a time.
Defaults to 10.
* **optional****)** – The number of queries to search for at a time.
Defaults to 10.
* **batch_size** (*int*)
* **queries** (*List* *[* *SearchParams* *]*) – A list of search queries to execute.
Each query can be either a string or a tuple of (query, params).
* **batch_size** (*int* *,* *optional*) – The number of queries to execute in each
batch. Defaults to 10.
* **Returns:**
The search results for each query.
A list of search results corresponding to each query.
* **Return type:**
List[Result]

```python
queries = [
"hello world",
("goodbye world", {"num_results": 5}),
]

results = await index.batch_search(queries)
```

#### `async clear()`

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

NOTE: This method requires custom behavior for Redis Cluster because here,
we can’t easily give control of the keys we’re clearing to the user so they
can separate them based on hash tag.

* **Returns:**
Count of records deleted from Redis.
* **Return type:**
Expand Down Expand Up @@ -617,6 +639,10 @@ Remove documents from the index by their document IDs.
This method converts document IDs to Redis keys automatically by applying
the index’s key prefix and separator configuration.

NOTE: Cluster users will need to incorporate hash tags into their
document IDs and only call this method with documents from a single hash
tag at a time.

* **Parameters:**
**ids** (*Union* *[* *str* *,* *List* *[* *str* *]* *]*) – The document ID or IDs to remove from the index.
* **Returns:**
Expand Down Expand Up @@ -700,7 +726,7 @@ Initialize from an existing search index in Redis by index name.

* **Parameters:**
* **name** (*str*) – Name of the search index in Redis.
* **redis_client** (*Optional* *[* *redis.Redis* *]*) – An
* **redis_client** (*Optional* *[* *Redis* *]*) – An
instantiated redis client.
* **redis_url** (*Optional* *[* *str* *]*) – The URL of the Redis server to
connect to.
Expand Down Expand Up @@ -872,11 +898,11 @@ results = await index.query(query)

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

Perform a search on this index.
Perform an async search against the index.

Wrapper around redis.search.Search that adds the index name
to the search query and passes along the rest of the arguments
to the redis-py ft.search() method.
Wrapper around the search API that adds the index name
to the query and passes along the rest of the arguments
to the redis-py ft().search() method.

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

* **Parameters:**
**redis_client** (*Redis* *|* *Redis*)
**redis_client** (*Redis* *|* *RedisCluster* *|* *Redis* *|* *RedisCluster*)

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

The underlying redis-py client object.

Expand Down
27 changes: 12 additions & 15 deletions 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
```

19:16:18 [RedisVL] INFO RedisVL version 0.5.2
16:41:26 [RedisVL] INFO RedisVL version 0.7.0


## Commands
Expand Down Expand Up @@ -74,7 +74,7 @@ fields:
!rvl index create -s schema.yaml
```

19:16:21 [RedisVL] INFO Index created successfully
16:43:40 [RedisVL] INFO Index created successfully



Expand All @@ -83,8 +83,8 @@ fields:
!rvl index listall
```

19:16:24 [RedisVL] INFO Indices:
19:16:24 [RedisVL] INFO 1. vectorizers
16:43:43 [RedisVL] INFO Indices:
16:43:43 [RedisVL] INFO 1. vectorizers



Expand Down Expand Up @@ -116,7 +116,7 @@ fields:
!rvl index delete -i vectorizers
```

19:16:29 [RedisVL] INFO Index deleted successfully
16:43:50 [RedisVL] INFO Index deleted successfully



Expand All @@ -125,7 +125,7 @@ fields:
!rvl index listall
```

19:16:32 [RedisVL] INFO Indices:
16:43:53 [RedisVL] INFO Indices:


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

19:16:35 [RedisVL] INFO Index created successfully
16:43:55 [RedisVL] INFO Index created successfully



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

19:16:38 [RedisVL] INFO Indices:
19:16:38 [RedisVL] INFO 1. vectorizers
16:43:58 [RedisVL] INFO Indices:
16:43:58 [RedisVL] INFO 1. vectorizers



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

19:16:43 [RedisVL] INFO Indices:
19:16:43 [RedisVL] INFO 1. vectorizers
16:44:03 [RedisVL] INFO Indices:
16:44:03 [RedisVL] INFO 1. vectorizers


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

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



```python
!rvl index destroy -i vectorizers
```

19:16:49 [RedisVL] INFO Index deleted successfully
16:44:13 [RedisVL] INFO Index deleted successfully

Loading