From 69ec014f34551eb292441760205f329893ac5a89 Mon Sep 17 00:00:00 2001 From: shiyu22 Date: Fri, 22 Jul 2022 17:39:50 +0800 Subject: [PATCH] Update README Signed-off-by: shiyu22 --- README.md | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a40c92..4e2761b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,100 @@ -# milvus +# Operator: ANN Insert: Milvus +*author: shiyu* + +
+ + + +## Desription + +Insert data into Milvus collections. **Please make sure you have [created Milvus Collection](https://milvus.io/docs/v2.0.x/create_collection.md) +and connected Milvus before loading the data.** + +
+ + + +## Code Example + +### Get the Collection first + +```python +from pymilvus import Collection, connections + +connections.connect(host='localhost', port='19530') +collection = Collection('your_collection_name') +``` + +### Example + +*Write the pipeline in simplified style:* + +```python +import towhee + +towhee.dc(your_embeddings) \ + .ann_insert.milvus(collection=collection) +``` + +*Write a same pipeline with explicit inputs/outputs name specifications:* + +```python +import towhee + +towhee.dc['vec'](your_embeddings) \ + .ann_insert.milvus['vec', 'results'](collection=collection) \ + .show() +``` + + + +### Load Collection + +> Please load the Collection after inserted data. + +```python +collection.load() +``` + +
+ + + +## Factory Constructor + +Create the operator via the following factory method: + +***ann_insert.milvus(collection)*** + +
+ + + + +**Parameters:** + +***collection:*** *str* or *pymilvus.Collection* + +The collection name or pymilvus.Collection in Milvus. + + +
+ + + +## Interface + +**Parameters:** + +***data:*** *list* + +The embedding data to be inserted. + +
+ + + +**Returns:** *mr* + +Return milvus results with `milvus.insert`.