create_collection

Function

Creates a specified collection in a vector database and sets an indexing mode.

Prototype

def create_collection(dense_dim, sparse_dim,  params)

Parameters

Parameter

Data Type

Required/Optional

Description

dense_dim

Integer

Optional

Vector length. The default value is None, but None cannot be set in dense and hybrid retrieval modes.

sparse_dim

Integer

Optional

Sparse vector dimension. The default value is 100000.

params

Dict

Optional

Additional parameter of the index type. The default value is None. If None is provided, an empty dictionary is used. For dictionary verification, the dictionary, its strings, and all iterable sequences must not exceed 1024 in length, and the number of nested dictionary layers cannot exceed 2. Parameter configurations now include "sparse" and "dense" types to specify whether they apply to sparse or dense retrieval modes. A configuration example is as follows:

{

"dense": {"lists": 200},

"sparse": {"m": 16, "ef_construction": 64}

}