Skip to content

Commit 7e56e1e

Browse files
Add readme
Signed-off-by: junjiejiangjjj <[email protected]>
1 parent 6491686 commit 7e56e1e

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed

CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Contributing Guide
2+
3+
Welcome contributors! This guide will help you get started with contributing to Milvus-lite.
4+
5+
Please always find the latest version of this guide at [CONTRIBUTING.md:main](https://github.com/milvus-io/milvus-lite/blob/main/CONTRIBUTING.md)
6+
7+
## How to set up the development environment
8+
The Milvus-lite project is written in Python. To set up the development environment, you need to install Python 3.8 or later. We recommend that you use a virtual environment to install the dependencies, although the Milvus-lite project requires a very small number of external packages.
9+
10+
The main dependencies for build Milvus-lite is to install dependencies of milvis, so generally you could refer to Milvus's [install_deps.sh](https://github.com/milvus-io/milvus/blob/master/scripts/install_deps.sh) as a reference. Please note, you should follow the related branch of Milvus. For example, if you want to build Milvus-lite with Milvus 2.4.0, you should checkout the branch of Milvus 2.4.0.
11+
12+
For python3 build wheel, we use the build module and requires newer version of setuptools. So you should install the latest version of setuptools and build.
13+
14+
## Build Milvus-lite
15+
```bash
16+
python3 setup.py bdist_wheel
17+
```
18+
19+
After build, you shoud have wheel package under dist folder.

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Introduction
2+
Milvus is an open-source vector database built to power embedding similarity search and AI applications. Milvus makes unstructured data search more accessible, and provides a consistent user experience regardless of the deployment environment.
3+
Milvus Lite is a lightweight version of Milvus that can be embedded into your Python application, integrating the core vector search functionality of Milvus.
4+
Please note that it is not suggested to use Milvus Lite in a production environment. Consider using Milvus clustered or the fully managed Milvus on Cloud.
5+
6+
# Requirements
7+
Milvus Lite is available in:
8+
- Google Colab
9+
- Jupyter Notebook
10+
11+
Here's also a list of verified OS types where Milvus Lite can successfully build and run:
12+
- Ubuntu >= 20.04 (x86_64)
13+
- MacOS >= 11.0 (Apple Silicon)
14+
15+
# Installation
16+
```shell
17+
pip install pymilvus
18+
```
19+
20+
# Usage
21+
In `pymilvus`, specify a local file name as uri parameter of MilvusClient to use Milvus Lite.
22+
```python
23+
from pymilvus import MilvusClient
24+
client = MilvusClient("./milvus_demo.db")
25+
```
26+
Or with old `connections.connect` API (not recommended):
27+
```python
28+
from pymilvus import connections
29+
connections.connect(uri="./milvus_demo.db")
30+
```
31+
32+
# Examples
33+
34+
```python
35+
from pymilvus import MilvusClient
36+
import numpy as np
37+
38+
client = MilvusClient("./milvus_demo.db")
39+
client.create_collection(
40+
collection_name="demo_collection",
41+
dimension=384 # The vectors we will use in this demo has 384 dimensions
42+
)
43+
44+
# Text strings to search from.
45+
docs = [
46+
"Artificial intelligence was founded as an academic discipline in 1956.",
47+
"Alan Turing was the first person to conduct substantial research in AI.",
48+
"Born in Maida Vale, London, Turing was raised in southern England.",
49+
]
50+
# For illustration, here we use fake vectors with random numbers (384 dimension).
51+
52+
vectors = [[ np.random.uniform(-1, 1) for _ in range(384) ] for _ in range(len(docs)) ]
53+
data = [ {"id": i, "vector": vectors[i], "text": docs[i], "subject": "history"} for i in range(len(vectors)) ]
54+
res = client.insert(
55+
collection_name="demo_collection",
56+
data=data
57+
)
58+
59+
# This will exclude any text in "history" subject despite close to the query vector.
60+
res = client.search(
61+
collection_name="demo_collection",
62+
data=[vectors[0]],
63+
filter="subject == 'history'",
64+
limit=2,
65+
output_fields=["text", "subject"],
66+
)
67+
print(res)
68+
69+
# a query that retrieves all entities matching filter expressions.
70+
res = client.query(
71+
collection_name="demo_collection",
72+
filter="subject == 'history'",
73+
output_fields=["text", "subject"],
74+
)
75+
print(res)
76+
77+
# delete
78+
res = client.delete(
79+
collection_name="demo_collection",
80+
filter="subject == 'history'",
81+
)
82+
print(res)
83+
```
84+
85+
# Contributing
86+
If you want to contribute to Milvus Lite, please read the [Contributing Guide](https://github.com/milvus-io/milvus-lite/blob/main/CONTRIBUTING.md) first.
87+
88+
# Report a bug
89+
When you use or develop milvus-lite, if you find any bug, please report it to us. You could submit an issue in [milvus-lite](https://github.com/milvus-io/milvus-lite/issues/new/choose) or report you [milvus](https://github.com/milvus-io/milvus/issues/new/choose) repo if you think it is a Milvus issue.
90+
91+
# License
92+
Milvus Lite is under the Apache 2.0 license. See the [LICENSE](https://github.com/milvus-io/milvus-lite/blob/main/LICENSE) file for details.

0 commit comments

Comments
 (0)