Skip to content

armgit / txtai

Public Imported from GitHub
0

💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows

Add test for embeddings shortcuts

davidmezzettidc57d6bf0d8e
diff --git a/test/python/testembeddings.py b/test/python/testembeddings.py
index 27816d91..acd9e479 100644
--- a/test/python/testembeddings.py
+++ b/test/python/testembeddings.py
@@ -446,6 +446,29 @@ class TestEmbeddings(unittest.TestCase):
self.embeddings.upsert([(0, "Looking out into the dreadful abyss", None)])
self.assertEqual(self.embeddings.count(), len(self.data))
+ def testShortcuts(self):
+ """
+ Test embeddings creation shortcuts
+ """
+
+ tests = [
+ ({"keyword": True}, ["scoring"]),
+ ({"keyword": "sif"}, ["scoring"]),
+ ({"sparse": True}, ["scoring"]),
+ ({"dense": True}, ["ann"]),
+ ({"hybrid": True}, ["ann", "scoring"]),
+ ({"hybrid": "tfidf"}, ["ann", "scoring"]),
+ ({"hybrid": "sparse"}, ["ann", "scoring"]),
+ ({"graph": True}, ["graph"]),
+ ]
+
+ for config, checks in tests:
+ embeddings = Embeddings(config)
+ embeddings.index(["test"])
+
+ for attr in checks:
+ self.assertIsNotNone(getattr(embeddings, attr))
+
def testSimilarity(self):
"""
Test similarity