add
Function
Adds a document index to a vector database. Specifically, this API first embeds a document chunk to obtain vectors, and then stores the vectors into a vector database.
Prototype
def add(ids: List[int], embeddings: np.ndarray, document_id, docs, metadatas)
Parameters
Parameter |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
ids |
List[int] |
Required |
Index ID list of vectors to be added. |
embeddings |
ndarray |
Required |
NumPy array object. |
document_id |
Integer |
Optional |
ID of the document to which vectors to be added belong. |
docs |
List[str] |
Optional |
Document to which vectors to be added. |
metadatas |
List[dict] |
Optional |
Metadata of the document to which vectors to be added. |
The shape of embeddings must be 2D. The number of vectors in embeddings must be equal to the length of ids. The number of documents in docs must be equal to the length of ids. The total number of vectors added at a time must be less than 10 million.