create
Function
Creates a MilvusDB object.
Prototype
@staticmethod def create(**kwargs)
Parameters
All input parameters of this method must be passed through keyword parameters.
Parameter |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
client |
MilvusClient |
Required |
Parameter under kwargs (see Class Introduction). The parameter must be passed; otherwise, KeyError is reported. |
params |
Dict |
Optional |
Additional parameter of the index type. The default value is {}, which corresponds to params of the add_index method. For details, see Milvus Index-a-Collection. 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": {"nlist": 128}, "sparse": {"inverted_index_algo": "DAAT_MAXSCORE"} } |
x_dim |
Integer |
Optional |
Vector dimensionality. The MilvusClient.create_collection method is called. For details, see create_collection. |
collection_name |
String |
Optional |
Collection name. The default value is rag_sdk. The MilvusClient.set_collection_name is called. For details, see set_collection_name. |
search_mode |
SearchMode |
Optional |
Retrieval mode. Currently, three modes are supported: DENSE for dense retrieval (default), SPARSE for sparse retrieval, and HYBRID for hybrid retrieval. For more details, see search_mode. |
auto_id |
Bool |
Optional |
Whether to automatically increment primary keys. The default value is False. |
index_type |
String |
Optional |
Vector retrieval type. Currently, FLAT (default), IVF_FLAT, IVF_PQ, and HNSW are supported. This parameter is valid for dense vectors in dense and hybrid retrieval modes. SPARSE_INVERTED_INDEX is used for sparse vector retrieval and cannot be changed. |
metric_type |
String |
Optional |
Vector distance calculation method, which can be IP, L2 (default), and COSINE. This parameter is valid for dense vectors in dense and hybrid retrieval modes. IP is used for sparse vector distance calculation and cannot be changed. |
auto_flush |
Bool |
Optional |
Whether to automatically update memory data during data changes. The default value is True. |
Return Value
Data Type |
Description |
|---|---|
MilvusDB |
MilvusDB object. |