add_sparse
Function
Adds a document index to a vector database. Specifically, this API first performs sparse representation on a document chunk to obtain sparse vectors, and then stores the vectors into a vector database.
Prototype
def add_sparse(ids, sparse_embeddings, document_id, docs, metadatas)
Parameters
Parameter |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
ids |
List[int] |
Required |
Index ID list of vectors to be added. Its length range is [0, 10 million). |
sparse_embeddings |
List[Dict[int, float]] |
Required |
Sparse vector 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 number of vectors in sparse_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.