fabricatio_milvus.models.milvus

A module containing the RAG (Retrieval-Augmented Generation) models.

Classes

MilvusScopedConfig

A class representing the configuration for Milvus.

MilvusDataBase

A base class for Milvus data.

MilvusClassicModel

A class representing a classic model stored in Milvus.

Module Contents

class fabricatio_milvus.models.milvus.MilvusScopedConfig(/, **data: Any)

Bases: fabricatio_core.models.generic.ScopedConfig

A class representing the configuration for Milvus.

milvus_uri: str | None = None

The URI of the Milvus server.

milvus_token: pydantic.SecretStr | None = None

The token for the Milvus server.

milvus_timeout: pydantic.PositiveFloat | None = None

The timeout for the Milvus server.

milvus_dimensions: pydantic.PositiveInt | None = None

The dimensions of the Milvus server.

class fabricatio_milvus.models.milvus.MilvusDataBase[ST: Dict[str, Any]](/, **data: Any)

Bases: fabricatio_rag.models.document.StoredDocumentModel[ST], fabricatio_rag.models.document.SearchedDocumentModel[ST], abc.ABC

A base class for Milvus data.

primary_field_name: ClassVar[str] = 'id'

The name of the primary field in Milvus.

vector_field_name: ClassVar[str] = 'vector'

The name of the vector field in Milvus.

index_type: ClassVar[str] = 'FLAT'

The type of index to be used in Milvus.

metric_type: ClassVar[str] = 'COSINE'

The type of metric to be used in Milvus.

prepare_insertion(vector: Sequence[float]) ST

Prepares the data for insertion into Milvus.

Returns:

A dictionary containing the data to be inserted into Milvus.

Return type:

dict

classmethod as_milvus_schema(dimension: int = 1024) pymilvus.CollectionSchema

Generates the schema for Milvus collection.

classmethod from_sequence(data: Sequence[ST]) List[Self]

Constructs a list of instances from a sequence of dictionaries.

class fabricatio_milvus.models.milvus.MilvusClassicModel[SD: Dict[str, Any]](/, **data: Any)

Bases: MilvusDataBase[SD]

A class representing a classic model stored in Milvus.

text: str

The text to be stored in Milvus.

subject: str = ''

The subject of the text.

classmethod from_raw(raw: SD) Self

Create a model instance from a raw Milvus search result.