pharmacy-pos-qr-system/backend/test_chroma.py
thug0bin be1e6c2bb7 feat(animal-chat): LanceDB 벡터 검색 RAG 통합
- LanceDB로 MD 문서 252개 청크 인덱싱
- /api/animal-chat에 벡터 검색 컨텍스트 주입
- 마지막 사용자 메시지로 관련 문서 검색 (top 3)
- ChromaDB Windows crash로 LanceDB 채택
2026-03-08 15:00:39 +09:00

22 lines
659 B
Python

# -*- 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!')