create
Function
Creates an OpenGaussDB object.
Prototype
@classmethod def create(**kwargs)
Parameters
All input parameters of this method must be passed through keyword parameters.
Parameter |
Data Type |
Required/Optional |
Description |
|---|---|---|---|
engine |
Engine |
Required |
Parameter under kwargs (see Class Introduction). The parameter must be passed; otherwise, KeyError is reported. |
index_type |
String |
Optional |
Vector retrieval type. Currently, IVFFLAT and HNSW (default) are supported. This parameter is valid for dense vectors in dense and hybrid retrieval modes. HNSW is used for sparse vector retrieval and cannot be changed. |
metric_type |
String |
Optional |
Vector distance calculation mode, which can be IP (default), L2, and COSINE. |
collection_name |
String |
Optional |
Collection name, which cannot be empty. The maximum length is 1024 characters. The value must be a valid Python identifier. The default value is vectorstore. |
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 SearchMode. |
dense_dim |
Integer |
Optional |
Dense vector dimension. |
sparse_dim |
Integer |
Optional |
Sparse vector dimension. The default value is 100000. Set this parameter based on the vocabulary size of a sparse vector model. For example, the vocabulary size of the BGE-M3 model is 250002. |
params |
Dict |
Optional |
Additional parameter of the index type. The default value is None. If None is provided, an empty dictionary is used. It corresponds to params in the add_index method. For details, see Vector Index Introduction of openGauss. 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} } |
Return Value
Data Type |
Description |
|---|---|
OpenGaussDB |
OpenGaussDB object. |