💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add tests
davidmezzettiaed1b225b106
diff --git a/test/python/testscoring.py b/test/python/testscoring.pyindex cb0f6a28..6ccc780d 100644--- a/test/python/testscoring.py+++ b/test/python/testscoring.py@@ -56,7 +56,7 @@ class TestScoring(unittest.TestCase):# Generate temp file pathindex = os.path.join(tempfile.gettempdir(), "bm25")- os.makedirs(index)+ os.makedirs(index, exist_ok=True)model = self.method("bm25")model.save(index)diff --git a/test/python/testvectors.py b/test/python/testvectors.pyindex 2e4562b9..02987ad4 100644--- a/test/python/testvectors.py+++ b/test/python/testvectors.py@@ -6,17 +6,31 @@ import osimport tempfileimport unittest-from txtai.vectors import WordVectors+from txtai.vectors import WordVectors, Vectorsclass TestVectors(unittest.TestCase):"""Vectors tests"""- def testBuild(self):+ def setUp(self):"""Test a WordVectors build."""+ # Word vectors path+ path = os.path.join(tempfile.gettempdir(), "vectors")+# Build word vectors on README file- WordVectors.build("README.md", 300, 3, os.path.join(tempfile.gettempdir(), "vectors"))+ WordVectors.build("README.md", 300, 3, path)++ # Save model path+ self.path = path + ".magnitude"++ def testLoad(self):+ model = Vectors.create("words", self.path, True, None)+ self.assertEqual(len(model.transform((None, ["txtai"], None))), 300)++ def testLookup(self):+ model = Vectors.create("words", self.path, True, None)+ self.assertEqual(model.lookup(["txtai", "embeddings", "sentence"]).shape, (3, 300))