Redis

Integrating Redis with Qyver

This guide outlines the steps required to configure and integrate Redis with Qyver.

Configuring an Existing Managed Redis Instance

To use Redis with Qyver, certain Redis modules are required. The easiest way to ensure compatibility is to use the official Redis Stack, which includes all necessary components. Installation instructions can be found in the official Redis documentation.

Alternatively, you can set up a managed Redis instance through Redis' cloud service, which offers a free tier. For detailed instructions on setting up a managed instance, refer to the Starting a Managed Redis Instance section below.

Once your Redis instance is operational, ensure that it is accessible from the server where it will be used. Additionally, configure authentication settings as required.


Configuration Modifications

To integrate Redis with Qyver, you need to include the RedisVectorDatabase class in your configuration. The following example demonstrates how to set it up:

from qyver import framework as qv

vector_database = qv.RedisVectorDatabase(
    "<your_redis_host>",  # (Required) Redis URL without port or additional fields.
    12315,  # (Required) The Redis port (must be an integer).
    default_query_limit=10,  # (Optional) Defines the maximum number of query results. Defaults to 10 if not specified.
    # Additional parameters can be provided as keyword arguments. These settings should follow the official Python Redis client configuration.
    # Refer to the documentation here: https://redis.readthedocs.io/en/stable/connections.html.
    # Example of basic authentication:
    username="test",
    password="password"
)

Once the vector database is configured, assign it to the executor:

...
executor = qv.RestExecutor(
    sources=[source],
    indices=[index],
    queries=[qv.RestQuery(qv.RestDescriptor("query"), query)],
    vector_database=vector_database  # Assign the configured RedisVectorDatabase instance
)
...

Starting a Managed Redis Instance

To create a managed Redis instance, sign in to Redis Labs and click New Database. On the setup page, locate the Type selector and choose Redis Stack (this is the default selection). If not selected, ensure Redis Stack is chosen.

For basic usage, no additional configurations are required. A default user and password are automatically generated. If you plan to use the instance for persistent data storage beyond temporary use, consider enabling High Availability (HA), data persistence, and other relevant settings.

Last updated