# -*- coding: utf-8 -*-
import os
from dotenv import load_dotenv
load_dotenv()

import chromadb

print('1. creating client...', flush=True)
client = chromadb.PersistentClient(path='./db/chroma_test3')
print('2. client created', flush=True)

# 임베딩 없이 컬렉션 생성
col = client.get_or_create_collection('test3')
print('3. collection created (no ef)', flush=True)

col.add(ids=['1'], documents=['hello world'], embeddings=[[0.1]*384])
print('4. document added with manual embedding', flush=True)

result = col.query(query_embeddings=[[0.1]*384], n_results=1)
print(f'5. query result: {len(result["documents"][0])} docs', flush=True)
print('Done!')
