2023-09-05 20:42:22 +08:00
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
2023-09-12 15:28:59 +08:00
|
|
|
async def test_embedding_email():
|
|
|
|
|
storage = ChromaVectorStore("test")
|
2023-09-05 20:42:22 +08:00
|
|
|
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()
|