mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
Merge pull request #1320 from Tymec/master
Add ability to use local embeddings model
This commit is contained in:
26
tests/embedder_test.py
Normal file
26
tests/embedder_test.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from autogpt.config import Config
|
||||
from autogpt.memory.base import get_embedding
|
||||
|
||||
# Required, because the get_embedding function uses it
|
||||
cfg = Config()
|
||||
|
||||
|
||||
class TestMemoryEmbedder(unittest.TestCase):
|
||||
def test_ada(self):
|
||||
cfg.memory_embedder = "ada"
|
||||
text = "Sample text"
|
||||
result = get_embedding(text)
|
||||
self.assertEqual(len(result), 1536)
|
||||
|
||||
def test_sbert(self):
|
||||
cfg.memory_embedder = "sbert"
|
||||
text = "Sample text"
|
||||
result = get_embedding(text)
|
||||
self.assertEqual(len(result), 768)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user