Skip to content

Commit

Permalink
[CLEANUP}
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Gomez authored and Kye Gomez committed Jul 8, 2024
1 parent 8033cbd commit 6e357a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "swarms-memory"
version = "0.0.1"
version = "0.0.2"
description = "Swarms Memory - Pytorch"
license = "MIT"
authors = ["Kye Gomez <[email protected]>"]
Expand Down
4 changes: 2 additions & 2 deletions swarms_memory/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from swarms_memory.chroma_db_wrapper import ChromaDBMemory
from swarms_memory.chroma_db_wrapper import ChromaDB
from swarms_memory.pinecone_wrapper import PineconeMemory

__all__ = ["ChromaDBMemory", "PineconeMemory"]
__all__ = ["ChromaDB", "PineconeMemory"]
2 changes: 1 addition & 1 deletion swarms_memory/chroma_db_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


# Results storage using local ChromaDB
class ChromaDBMemory(BaseVectorDatabase):
class ChromaDB(BaseVectorDatabase):
"""
ChromaDB database
Expand Down
12 changes: 6 additions & 6 deletions tests/test_chromadb.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from unittest.mock import patch, MagicMock
from swarms_memory.chroma_db_wrapper import ChromaDBMemory
from swarms_memory.chroma_db_wrapper import ChromaDB


@patch("chromadb.PersistentClient")
@patch("chromadb.Client")
def test_init(mock_client, mock_persistent_client):
chroma_db = ChromaDBMemory(
chroma_db = ChromaDB(
metric="cosine",
output_dir="swarms",
limit_tokens=1000,
Expand All @@ -26,7 +26,7 @@ def test_init(mock_client, mock_persistent_client):
@patch("chromadb.PersistentClient")
@patch("chromadb.Client")
def test_add(mock_client, mock_persistent_client):
chroma_db = ChromaDBMemory()
chroma_db = ChromaDB()
mock_collection = MagicMock()
chroma_db.collection = mock_collection
doc_id = chroma_db.add("test document")
Expand All @@ -39,7 +39,7 @@ def test_add(mock_client, mock_persistent_client):
@patch("chromadb.PersistentClient")
@patch("chromadb.Client")
def test_query(mock_client, mock_persistent_client):
chroma_db = ChromaDBMemory()
chroma_db = ChromaDB()
mock_collection = MagicMock()
chroma_db.collection = mock_collection
mock_collection.query.return_value = {
Expand All @@ -55,11 +55,11 @@ def test_query(mock_client, mock_persistent_client):
@patch("chromadb.PersistentClient")
@patch("chromadb.Client")
@patch("os.walk")
@patch("swarms_memory.chroma_db_wrapper.ChromaDBMemory.add")
@patch("swarms_memory.chroma_db_wrapper.ChromaDB.add")
def test_traverse_directory(
mock_add, mock_walk, mock_client, mock_persistent_client
):
chroma_db = ChromaDBMemory(docs_folder="test_folder")
chroma_db = ChromaDB(docs_folder="test_folder")
mock_walk.return_value = [("root", "dirs", ["file1", "file2"])]
chroma_db.traverse_directory()
assert mock_add.call_count == 2

0 comments on commit 6e357a3

Please sign in to comment.