File size: 686 Bytes
1173efb
 
b6c799c
1173efb
b6c799c
1173efb
b6c799c
1173efb
b6c799c
1173efb
 
 
 
 
b6c799c
1173efb
 
 
 
 
 
 
b6c799c
1173efb
 
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
# from chromadb import Client
# from sentence_transformers import SentenceTransformer

# client = Client(persist_directory="./chroma_db")

# collection = client.get_or_create_collection(name="docs")

# embed_model = SentenceTransformer("all-MiniLM-L6-v2")

# docs = [
#     "Welcome to my bakery. We sell cookies and cakes.",
#     "Our delivery policy: we deliver within 2 days in Karachi.",
#     "Contact us at info@example.com for queries."
# ]

# for i, doc in enumerate(docs):
#     emb = embed_model.encode(doc).tolist()
#     collection.add(
#         documents=[doc],
#         embeddings=[emb],
#         ids=[str(i)]
#     )

# client.persist()
# print("Vector DB created!")