18 lines
530 B
Python
18 lines
530 B
Python
from pymilvus import Collection, db, connections
|
|
import numpy as np
|
|
|
|
conn = connections.connect(host="192.168.1.156", port=19530)
|
|
db.using_database("sample_db")
|
|
coll_name = 'word_vector'
|
|
|
|
mids, embedings, counts, descs = [], [], [], []
|
|
data_num = 100
|
|
for idx in range(0, data_num):
|
|
mids.append(idx)
|
|
embedings.append(np.random.normal(0, 0.1, 768).tolist())
|
|
descs.append(f'random num {idx}')
|
|
counts.append(idx)
|
|
|
|
collection = Collection(coll_name)
|
|
mr = collection.insert([mids, embedings, descs, counts])
|
|
print(mr) |