Skip to main content

milvus_logo_with_a_steampunk_and_industrial_style

milvus_api

milvus_api is a Python library that primarily provides functionalities to manage databases, including creating collections, inserting data, searching and updating index.

Installation

This project depends on several Python libraries. Use the following command to install the necessary libraries:

pip install pymilvus==2.4.0 milvus-model==0.2.0 pydantic==2.7.0 tqdm==4.66.2 FlagEmbedding==1.2.9 torch==2.2.2 numpy==1.24.4

Usage Examples

Creating a Database Collection

Here's how to create a new database collection using milvus_api:

from milvus_api.db_model.milvus_db import MilvusDB
from pymilvus import FiledSchema, DataType

host = 'localhost'
port = '19530'
db = MilvusDB(host, port)

fields = [  
    FieldSchema(name="id", dtype=DataType.INT64, auto_id=True, is_primary=True),
    FieldSchema(name="embeddings", dtype=DataType.FLOAT_VECTOR, dim=1024)
]

db.create_collection("my_collection", 1000, fields, "FLAT", "COSINE")

Data Encoding Using the Model

Here's how to perform query encoding using the embedding model in milvus_api:

from milvus_api.embed_model.bgem3 import PyMilvusBGEM3

query = ["Are you afraid of the earthquake"]
model_name = 'bgem3_model'

# Initialize the model
bgem3 = PyMilvusBGEM3(model_name)
results = bgem3.encode(query)

Release Note

  • 0.2.1:(Feat): support IVF_PQ indexing algorithm for switch_index.
  • 0.2.0:(Feat): add the switch_index operation to MilvusDB object.
from milvus_api.db_model.milvus_db import MilvusDB

db = MilvusDB(host, port)

# Assume you already have a collection with index.
db.switch_index("your_collection_name", "drop_index_name", "new_index_type", "field_name", metric_type")
  • 0.1.4:(BugFix): Fix the logic error when do search operation.
  • 0.1.3:(BugFix): Fix the error caused by the non-specific field argument during creating collection.
  • 0.1.2:(BugFix): Cancel partial information of info function.
  • 0.1.1: Modify this project structure to ensure that users can import 'milvus_api' normally.

Contributions

Thanks to all developers who contributed to this project. If you would like to contribute code, please follow the existing code style and submit a pull request.

Copyright and License

This project is licensed under the Apache License 2.0.

Other Information

This README.md file is now complete, including an introduction to the project, installation instructions, usage examples, contribution guidelines, and copyright and licensing information. You can save this content as the README.md file in the root directory of your project. If you need further modifications or wish to add additional information, feel free to let me know!

Metadata

Release files for milvus-api 0.2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for milvus-api 0.2.1.2
File Size Uploaded
milvus_api-0.2.1.2.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for milvus-api 0.2.1.2
File Interpreter ABI Platform
milvus_api-0.2.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / milvus_api-0.2.1.2.tar.gz

Download URL milvus_api-0.2.1.2.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fae6edfcdb41534e19e6be1c0802aea007f07688b54015a5706203abefc90015
BLAKE2b-256 checksum
How to use checksums
d34c522c04cf5fafb0291e1fa6f122ced141a95862cfa1e81f3e5c1cf55f67c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release files / milvus_api-0.2.1.2-py3-none-any.whl

Download URL milvus_api-0.2.1.2-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c6f39b46d4fcb419b1bd581c8b671406951c96d5d00da6c55985781ea5b3b2e
BLAKE2b-256 checksum
How to use checksums
75b4bff61c90812fa5aa76f26e5a65a7731aafd95c4532754acfa2d8250ed6e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.2.1.2 This release

2 release files

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page