marqo
__all__ = ['MarqoVectorStoreDriver']
module-attribute
MarqoVectorStoreDriver
Bases: BaseVectorStoreDriver
A Vector Store Driver for Marqo.
Attributes:
Name | Type | Description |
---|---|---|
api_key |
str
|
The API key for the Marqo API. |
url |
str
|
The URL to the Marqo API. |
client |
Client
|
An optional Marqo client. Defaults to a new client with the given URL and API key. |
index |
str
|
The name of the index to use. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
api_key: str = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
index: str = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
url: str = field(kw_only=True, metadata={'serializable': True})
class-attribute
instance-attribute
client()
delete_index(name)
Delete an index in the Marqo client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the index to delete. |
required |
delete_vector(vector_id)
get_indexes()
Get a list of all indexes in the Marqo client.
Returns:
Type | Description |
---|---|
list[str]
|
The list of all indexes. |
load_entries(*, namespace=None)
Load all document entries from the Marqo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
namespace
|
Optional[str]
|
The namespace to filter entries by. |
None
|
Returns:
Type | Description |
---|---|
list[Entry]
|
The list of loaded Entries. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
load_entry(vector_id, *, namespace=None)
Load a document entry from the Marqo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector_id
|
str
|
The ID of the vector to load. |
required |
namespace
|
Optional[str]
|
The namespace of the vector to load. |
None
|
Returns:
Type | Description |
---|---|
Optional[Entry]
|
The loaded Entry if found, otherwise None. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
query(query, *, count=None, namespace=None, include_vectors=False, include_metadata=True, **kwargs)
Query the Marqo index for documents.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The query string. |
required |
count
|
Optional[int]
|
The maximum number of results to return. |
None
|
namespace
|
Optional[str]
|
The namespace to filter results by. |
None
|
include_vectors
|
bool
|
Whether to include vector data in the results. |
False
|
include_metadata
|
bool
|
Whether to include metadata in the results. |
True
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
Type | Description |
---|---|
list[Entry]
|
The list of query results. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
upsert_text(string, *, vector_id=None, namespace=None, meta=None, **kwargs)
Upsert a text document into the Marqo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string
|
str
|
The string to be indexed. |
required |
vector_id
|
Optional[str]
|
The ID for the vector. If None, Marqo will generate an ID. |
None
|
namespace
|
Optional[str]
|
An optional namespace for the document. |
None
|
meta
|
Optional[dict]
|
An optional dictionary of metadata for the document. |
None
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ID of the document that was added. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
upsert_text_artifact(artifact, *, namespace=None, meta=None, vector_id=None, **kwargs)
Upsert a text artifact into the Marqo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
artifact
|
TextArtifact
|
The text artifact to be indexed. |
required |
namespace
|
Optional[str]
|
An optional namespace for the artifact. |
None
|
meta
|
Optional[dict]
|
An optional dictionary of metadata for the artifact. |
None
|
vector_id
|
Optional[str]
|
An optional explicit vector_id. |
None
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The ID of the artifact that was added. |
Source code in griptape/drivers/vector/marqo_vector_store_driver.py
upsert_vector(vector, *, vector_id=None, namespace=None, meta=None, **kwargs)
Upsert a vector into the Marqo index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector
|
list[float]
|
The vector to be indexed. |
required |
vector_id
|
Optional[str]
|
The ID for the vector. If None, Marqo will generate an ID. |
None
|
namespace
|
Optional[str]
|
An optional namespace for the vector. |
None
|
meta
|
Optional[dict]
|
An optional dictionary of metadata for the vector. |
None
|
kwargs
|
Any
|
Additional keyword arguments to pass to the Marqo client. |
{}
|
Raises:
Type | Description |
---|---|
Exception
|
This function is not yet implemented. |
Returns:
Type | Description |
---|---|
str
|
The ID of the vector that was added. |