Parameter | Type | Description |
---|---|---|
items | List[Dict[str, Any]] | A list of dictionaries, where each dictionary has the format {"id": str, "vector": List[float], "contents": Union[bytes, str], "metadata": Dict[str, str]} . |
item
dictionary has the following fields:
Parameter | Type | Description |
---|---|---|
id | str | Unique string identifier for the item. |
vector | List[float] | Embedding vector as a list of floats (optional if index is configured to compute embeddings). |
contents | bytes , str or Image | Item contents (optional). Must be a str or Image if index is configured to compute embeddings. |
metadata | Dict[str, any] | Dictionary of key-value metadata pairs associated with the vector (optional). |
embedding_model
parameter in create_index()
), then the vector
parameter is optional.
If vector
provided, then it will be used (its dimensionality must match that of the embedding_model
).
If vector
is not provided, a vector embedding will be auto-generated from contents
using sentence-transformers
. contents
must be text in this case.ValueError
RuntimeError
id
and vector
fields as tuples, if you wish to skip the dictionary. On big datasets, this can make a signficant difference in memory usage.int
for IDs).Parameter | Type | Description |
---|---|---|
ids | np.ndarray | 1D NumPy array of shape (num_items,) containing unique identifiers for each vector. Can be string or integer dtype. Length must match vectors . |
vectors | np.ndarray | 2D NumPy array of shape (num_items, vector_dim) with dtype=float32 , representing vector embeddings. |
ValueError
RuntimeError