You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
727 B
25 lines
727 B
from _chroma import ChromaDB |
|
from _arango import arango |
|
|
|
chroma = ChromaDB() |
|
|
|
db = arango.db |
|
q = "for doc in persons filter doc.other != true return doc" |
|
persons = list(db.aql.execute(q)) |
|
|
|
# Lists to store the documents, metadatas and ids |
|
documents = [] |
|
metadatas = [] |
|
ids = [] |
|
|
|
for person in persons: |
|
if "info" in person: |
|
info = "\n".join(person["info"]) |
|
documents.append(person["name"]) |
|
# documents.append(f"{person['name']}\n{info}") |
|
metadata = {"name": person["name"], "_key": person["_key"]} |
|
metadatas.append(metadata) |
|
ids.append(person["_key"]) |
|
|
|
collection = chroma.client.get_collection("mala_persons") |
|
collection.add(documents=documents, metadatas=metadatas, ids=ids) |