File size: 527 Bytes
932db78
 
 
 
0fd4a4d
932db78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0fd4a4d
 
932db78
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from sentence_transformers import SentenceTransformer
# Connect using a MilvusClient object
from pymilvus import Collection

from db_connect import connect, disconnect

#
with open('responses.txt', 'r') as file:
  content = file.read()
  contents = content.split('\n\n')

model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
embeddings = model.encode(contents)

data = [
    contents,
    embeddings
]

connect()

collection = Collection("Response")
collection.insert(data)
collection.flush()

disconnect()