High-level API for Redis Vector Sets (Redis 8.0+).
Wraps the Vector Set commands with a connection-aware interface. For raw
command builders, see Redis.Commands.VectorSet.
Quick Start
# Add elements with vectors
{:ok, 1} = Redis.VectorSet.vadd(conn, "movies", "matrix", [0.1, 0.8, 0.3])
# Search by vector similarity
{:ok, results} = Redis.VectorSet.search(conn, "movies", [0.1, 0.8, 0.3], count: 5)
# Search by existing element
{:ok, results} = Redis.VectorSet.vsim(conn, "movies", {:element, "matrix"}, count: 10)
# Manage attributes
{:ok, "OK"} = Redis.VectorSet.vsetattr(conn, "movies", "matrix", ~s({"year": 1999}))
{:ok, json} = Redis.VectorSet.vgetattr(conn, "movies", "matrix")Attribute Filtering
When searching with vsim/4 or search/4, the :filter option accepts
a filter expression string that is evaluated against element attributes:
Redis.VectorSet.search(conn, "movies", vector, filter: ".year > 2000")
Summary
Functions
Searches for similar elements using a vector.
Adds an element with a vector to a vector set.
Returns the number of elements in a vector set.
Returns the vector dimensions of a vector set.
Gets the embedding vector of an element.
Gets the JSON attributes of an element.
Returns information about a vector set.
Gets the graph links of an element.
Returns one or more random elements from a vector set.
Removes an element from a vector set.
Sets JSON attributes on an element.
Performs a similarity search on a vector set.
Functions
Searches for similar elements using a vector.
This is a convenience wrapper around vsim/4 that accepts a plain list of
floats as the query vector instead of requiring the {:vector, v} tuple.
{:ok, results} = Redis.VectorSet.search(conn, "movies", [0.1, 0.8, 0.3], count: 5)
Adds an element with a vector to a vector set.
See Redis.Commands.VectorSet.vadd/4 for available options.
Returns the number of elements in a vector set.
Returns the vector dimensions of a vector set.
Gets the embedding vector of an element.
See Redis.Commands.VectorSet.vemb/3 for available options.
Gets the JSON attributes of an element.
Returns information about a vector set.
Gets the graph links of an element.
See Redis.Commands.VectorSet.vlinks/3 for available options.
Returns one or more random elements from a vector set.
See Redis.Commands.VectorSet.vrandmember/2 for available options.
Removes an element from a vector set.
Sets JSON attributes on an element.
Performs a similarity search on a vector set.
The search_input is either {:element, name} to search by an existing
element, or {:vector, [floats]} to search by a raw vector.
See Redis.Commands.VectorSet.vsim/3 for available options.