Vector redis
RedisVectorStore
A class for managing a vector store in Redis, including loading data and creating schemas for embeddings.
Attributes:
Name | Type | Description |
---|---|---|
redis_url |
str
|
The URL for connecting to the Redis instance. |
index |
SearchIndex
|
The Redis search index instance. |
keys |
list
|
The keys loaded into the Redis vector store. |
info |
dict
|
Information about the current Redis search index. |
Source code in model/vector_redis.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
__init__(redis_url)
Initializes the RedisVectorStore instance with a Redis URL.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
redis_url
|
str
|
The Redis connection URL. |
required |
Source code in model/vector_redis.py
23 24 25 26 27 28 29 30 31 32 33 34 |
|
create_schema(config, dimensions=3072, overwrite=True)
Creates a schema in Redis for storing document embeddings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
AppConfig
|
The application configuration object. |
required |
dimensions
|
int
|
The number of dimensions for the vector embeddings. Defaults to 3072. |
3072
|
overwrite
|
bool
|
Whether to overwrite an existing schema. Defaults to True. |
True
|
Returns:
Name | Type | Description |
---|---|---|
SearchIndex |
SearchIndex
|
The Redis search index instance. |
Source code in model/vector_redis.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
load_data(emb_obj, config)
Loads data from an embedding object into the Redis vector store.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
emb_obj
|
InspectorEmbeddings
|
The embeddings object containing vector data and dimensions. |
required |
config
|
AppConfig
|
The application configuration object. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
A list of keys corresponding to the loaded data in the Redis store. |
Source code in model/vector_redis.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|