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)

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.

The number of vectors contained in sparse_embeddings must be equal to the length of ids. The total number of vectors added at a time is less than 10 million.