fabricatio-milvus
Milvus vector database integration for Fabricatio — store, search, and retrieve document embeddings with the Fabricatio RAG framework.
Installation
pip install fabricatio[milvus]
Or install all Fabricatio components:
pip install fabricatio[full]
Overview
fabricatio-milvus extends Fabricatio's RAG (Retrieval-Augmented Generation) system with a Milvus vector database backend. It provides:
- Pydantic-based document models that auto-generate Milvus collection schemas from field type annotations.
- A
MilvusRAGcapability class implementing theadd_document/afetch_document/aretrievecontract backed bypymilvus. - Ready-to-use
Actionsubclass (InjectToDB) for building agent pipelines.
Configuration
All options below are read through the fabricatio configuration chain (see the
Configuration Guide at ../../docs/source/configuration.rst). Set them under the
[ext.milvus] table in fabricatio.toml, equivalently under
[tool.fabricatio.ext.milvus] in pyproject.toml, or via
FABRICATIO_EXT__MILVUS__<FIELD_UPPER> environment variables.
# fabricatio.toml
[ext.milvus]
milvus_uri = "http://localhost:19530"
milvus_timeout = 10.0
milvus_dimensions = 1536
| Option | Type | Default | Description |
|---|---|---|---|
milvus_uri |
Optional[str] |
None |
The URI of the Milvus server. |
milvus_timeout |
Optional[float] |
None |
The timeout of the Milvus server in seconds. |
milvus_token |
Optional[SecretStr] |
None |
The token for Milvus authentication. |
milvus_dimensions |
Optional[int] |
None |
The dimensions for Milvus vectors. |
Access at runtime: from fabricatio_milvus.config import milvus_config.
Key Components
Models — fabricatio_milvus.models
| Class | Description |
|---|---|
MilvusDataBase[ST] |
Abstract base combining StoredDocumentModel and SearchedDocumentModel. Generates Milvus CollectionSchema from Pydantic fields (int → INT64, str → VARCHAR, float → DOUBLE, list[str] → ARRAY[VARCHAR], JsonValue → JSON). Default index type FLAT, metric type COSINE. |
MilvusClassicModel[SD] |
Minimal concrete model with a single text: str field. |
MilvusScopedConfig |
Per-instance override for Milvus connection parameters (uri, token, timeout, dimensions). |
Capabilities — fabricatio_milvus.capabilities
| Class / Function | Description |
|---|---|
create_client(uri, token, timeout) |
Cached factory returning a pymilvus.MilvusClient. |
AddConfig |
Configuration for add_document: collection_name, flush. |
FetchConfig[D] |
Configuration for afetch_document: document_model, collection_name, similarity_threshold (default 0.37), result_per_query (default 10), tei_endpoint, reranker_threshold, filter_expr. |
MilvusRAG[D, AC, FC] |
Core RAG class backed by Milvus. Inherits from RAG, MilvusScopedConfig, UseEmbedding, UseReranker, UseLLM. |
MilvusRAG methods:
client— property returning theMilvusClient, eagerly created on construction from config.add_document(data, config)— vectorize documents and insert into a collection. Creates the collection if it doesn't exist.afetch_document(query, config)— vectorize query strings, search Milvus, deduplicate by ID, sort by distance descending, and deserialize into typed document models.aretrieve(query, document_model, ...)— convenience wrapper that builds aFetchConfigand callsafetch_document.
Actions — fabricatio_milvus.actions
| Action | Description |
|---|---|
InjectToDB |
Action that injects MilvusDataBase instances into a Milvus collection. Automatically creates the collection with the correct schema and index if needed. Supports override_inject to drop and recreate. |
Usage Example
from fabricatio_milvus.actions.rag import InjectToDB
from fabricatio_milvus.models.milvus import MilvusClassicModel
# Create document models
docs = [
MilvusClassicModel(text="Fabricatio is a Python library for building LLM applications."),
MilvusClassicModel(text="Milvus is an open-source vector database."),
]
# Inject into Milvus
action = InjectToDB(
collection_name="my_knowledge_base",
milvus_uri="http://localhost:19530",
)
await action.execute(to_inject=docs)
Dependencies
fabricatio-core— core interfaces, config, and utilitiesfabricatio-rag— RAG abstractions (RAG, document models)pymilvus(>=2.5.4) — Milvus Python SDKpydantic(>=2.7.1) — data validation and schema generationmore-itertools(>=10.8.0) — additional itertools
License
MIT
Metadata
Release files for fabricatio-milvus 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fabricatio_milvus-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for fabricatio_milvus-0.4.0-py3-none-any.whl |
Release files / fabricatio_milvus-0.4.0-py3-none-any.whl
| Download URL | fabricatio_milvus-0.4.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c315bd9d0ebf878ec57854f2106db18598aba5b6fe2ae848d23db54b6a0d4673
|
|
BLAKE2b-256 checksum How to use checksums |
97a6ac96cd7b47175c63696b2175a7fef667b8482ac1571d243a7e92b59f45a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for fabricatio-milvus 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.