forked from TransformerOptimus/SuperAGI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request TransformerOptimus#1061 from TransformerOptimus/we…
…aviate-backend-main Weaviate Backend
- Loading branch information
Showing
13 changed files
with
245 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from typing import Any | ||
from superagi.vector_embeddings.base import VectorEmbeddings | ||
|
||
class Weaviate(VectorEmbeddings): | ||
|
||
def __init__(self, uuid, embeds, metadata): | ||
self.uuid = uuid | ||
self.embeds = embeds | ||
self.metadata = metadata | ||
|
||
def get_vector_embeddings_from_chunks(self): | ||
""" Returns embeddings for vector dbs from final chunks""" | ||
|
||
return {'ids': self.uuid, 'data_object': self.metadata, 'vectors': self.embeds} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
25 changes: 25 additions & 0 deletions
25
tests/integration_tests/vector_embeddings/test_weaviate.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import unittest | ||
from superagi.vector_embeddings.base import VectorEmbeddings | ||
from superagi.vector_embeddings.weaviate import Weaviate | ||
|
||
class TestWeaviate(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.weaviate = Weaviate(uuid="1234", embeds=[0.1, 0.2, 0.3, 0.4], metadata={"info": "sample data"}) | ||
|
||
def test_init(self): | ||
self.assertEqual(self.weaviate.uuid, "1234") | ||
self.assertEqual(self.weaviate.embeds, [0.1, 0.2, 0.3, 0.4]) | ||
self.assertEqual(self.weaviate.metadata, {"info": "sample data"}) | ||
|
||
def test_get_vector_embeddings_from_chunks(self): | ||
expected_result = { | ||
"ids": "1234", | ||
"data_object": {"info": "sample data"}, | ||
"vectors": [0.1, 0.2, 0.3, 0.4] | ||
} | ||
self.assertEqual(self.weaviate.get_vector_embeddings_from_chunks(), expected_result) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
Oops, something went wrong.