parent
b84ac6211b
commit
0137222073
1 changed files with 25 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||||
|
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) |
||||||
Loading…
Reference in new issue