Created on

Return to the Index

This card can also be read via Gemini.

from glob import glob

from tqdm import tqdm

import os

import chromadb

client = chromadb.PersistentClient(path='xroma.db')

removed because it vomits a permission error

client.reset() # destroy the database

try:

client.delete_collection(name='zed')

except:

pass # don't really care if the collection didn't exist

collection = client.create_collection(name='zed')

os.chdir("/home/icedquinn/Zettelkasten/")

for fn in tqdm(glob("c*")):

with open(fn, "r") as f:

XXX it's possible to batch, and we should, but then we don't get progress bars

collection.add(

documents=[f.read()],

ids=[fn],

)