Add chromadb based vector store impl and test case

This commit is contained in:
liyaxing
2023-09-05 20:42:22 +08:00
parent cff34c6aba
commit 188595beb6
8 changed files with 96 additions and 15 deletions
+29
View File
@@ -0,0 +1,29 @@
import sys
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
sys.path.append("{}/../src/".format(dir_path))
print(sys.path)
from knowledge import ChromaVectorStore
import asyncio
import unittest
async def test_vector():
storage = ChromaVectorStore("", "test")
await storage.insert([1, 2, 3], "test")
ids = await storage.query([1, 2, 3], 10)
print(ids)
class TestVectorSTorage(unittest.TestCase):
def test_run(self):
asyncio.run(test_vector())
if __name__ == "__main__":
unittest.main()