🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fix chromadb ut
betterwangac14814d7408
diff --git a/metagpt/document_store/chromadb_store.py b/metagpt/document_store/chromadb_store.pyindex d7344d41b..8c2114f66 100644--- a/metagpt/document_store/chromadb_store.py+++ b/metagpt/document_store/chromadb_store.py@@ -11,9 +11,9 @@ import chromadbclass ChromaStore:"""If inherited from BaseStore, or importing other modules from metagpt, a Python exception occurs, which is strange."""- def __init__(self, name):+ def __init__(self, name, get_or_create: bool = True):client = chromadb.Client()- collection = client.create_collection(name)+ collection = client.create_collection(name, get_or_create=get_or_create)self.client = clientself.collection = collectiondiff --git a/tests/metagpt/document_store/test_faiss_store.py b/tests/metagpt/document_store/test_faiss_store.pyindex 97f84095a..f7032be9f 100644--- a/tests/metagpt/document_store/test_faiss_store.py+++ b/tests/metagpt/document_store/test_faiss_store.py@@ -16,7 +16,7 @@ from metagpt.roles import Sales@pytest.mark.asyncioasync def test_search_json():- store = FaissStore(EXAMPLE_PATH / "data/example.json")+ store = FaissStore(EXAMPLE_PATH / "data/search_kb/example.json")role = Sales(profile="Sales", store=store)query = "Which facial cleanser is good for oily skin?"result = await role.run(query)@@ -25,7 +25,7 @@ async def test_search_json():@pytest.mark.asyncioasync def test_search_xlsx():- store = FaissStore(EXAMPLE_PATH / "data/example.xlsx", meta_col="Answer", content_col="Question")+ store = FaissStore(EXAMPLE_PATH / "data/search_kb/example.xlsx", meta_col="Answer", content_col="Question")role = Sales(profile="Sales", store=store)query = "Which facial cleanser is good for oily skin?"result = await role.run(query)@@ -34,7 +34,7 @@ async def test_search_xlsx():@pytest.mark.asyncioasync def test_write():- store = FaissStore(EXAMPLE_PATH / "data/example.xlsx", meta_col="Answer", content_col="Question")+ store = FaissStore(EXAMPLE_PATH / "data/search_kb/example.xlsx", meta_col="Answer", content_col="Question")_faiss_store = store.write()assert _faiss_store.storage_context.docstoreassert _faiss_store.storage_context.vector_store.client