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 additional methods

davidmezzetti89299926bdcf
diff --git a/src/python/txtai/scoring/pgtext.py b/src/python/txtai/scoring/pgtext.py
index aa149db3..68b56d1e 100644
--- a/src/python/txtai/scoring/pgtext.py
+++ b/src/python/txtai/scoring/pgtext.py
@@ -118,6 +118,9 @@ class PGText(Scoring):
def isnormalized(self):
return True
+ def isbayes(self):
+ return False
+
def initialize(self, recreate=False):
"""
Initializes a new database session.
diff --git a/src/python/txtai/scoring/sparse.py b/src/python/txtai/scoring/sparse.py
index 4f0c7357..ce9cd626 100644
--- a/src/python/txtai/scoring/sparse.py
+++ b/src/python/txtai/scoring/sparse.py
@@ -130,6 +130,9 @@ class Sparse(Scoring):
def isnormalized(self):
return self.isnormalize or self.model.isnormalize
+ def isbayes(self):
+ return False
+
def start(self, checkpoint):
"""
Starts an encoding processing thread.
diff --git a/test/python/testscoring/testkeyword.py b/test/python/testscoring/testkeyword.py
index 1f91255c..048b514f 100644
--- a/test/python/testscoring/testkeyword.py
+++ b/test/python/testscoring/testkeyword.py
@@ -111,7 +111,7 @@ class TestKeyword(unittest.TestCase):
self.assertEqual(scoring.count(), len(self.data) - 1)
# PGText is a normalized sparse index
- self.assertTrue(scoring.issparse() and scoring.isnormalized())
+ self.assertTrue(scoring.issparse() and scoring.isnormalized() and not scoring.isbayes())
self.assertIsNone(scoring.weights("This is a test".split()))
# Close scoring
diff --git a/test/python/testscoring/testsparse.py b/test/python/testscoring/testsparse.py
index 3abbc11d..179354e1 100644
--- a/test/python/testscoring/testsparse.py
+++ b/test/python/testscoring/testsparse.py
@@ -67,7 +67,7 @@ class TestSparse(unittest.TestCase):
self.assertEqual(index, 5)
# Sparse vectors is a normalized sparse index
- self.assertTrue(scoring.issparse() and scoring.isnormalized())
+ self.assertTrue(scoring.issparse() and scoring.isnormalized() and not scoring.isbayes())
self.assertIsNone(scoring.weights("This is a test".split()))
# Close scoring