🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
chore: minor update for weaviate integration (#2584)
Wendong-Fan8a053e85e64d
diff --git a/camel/storages/vectordb_storages/weaviate.py b/camel/storages/vectordb_storages/weaviate.pyindex 9a7a2dd31..03bd56d78 100644--- a/camel/storages/vectordb_storages/weaviate.py+++ b/camel/storages/vectordb_storages/weaviate.py@@ -12,7 +12,6 @@# limitations under the License.# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========import json-import loggingimport mathimport refrom datetime import datetime@@ -30,6 +29,7 @@ from typing import (if TYPE_CHECKING:from weaviate import WeaviateClient+from camel.logger import get_loggerfrom camel.storages.vectordb_storages import (BaseVectorStorage,VectorDBQuery,@@ -39,7 +39,7 @@ from camel.storages.vectordb_storages import ()from camel.utils import dependencies_required-logger = logging.getLogger(__name__)+logger = get_logger(__name__)# Type definitions for configuration options@@ -130,8 +130,6 @@ class WeaviateStorage(BaseVectorStorage):ValueError: If connection parameters are invalid or missing.RuntimeError: If there's an error setting up the collection.--Note:This implementation supports synchronous operations only.The client connection is automatically handled and closed when the@@ -217,6 +215,9 @@ class WeaviateStorage(BaseVectorStorage):**kwargs,}+ # Store original collection creation kwargs for clear() method+ self._original_collection_kwargs = kwargs.copy()+# Create client using the new unified approachself._client = self._get_connection_client()logger.info(@@ -697,7 +698,7 @@ class WeaviateStorage(BaseVectorStorage):r"""Remove all vectors from the storage."""try:self._client.collections.delete(self.collection_name)- self._create_collection()+ self._create_collection(**self._original_collection_kwargs)except Exception as e:raise RuntimeError(f"Failed to clear Weaviate collection: {e}")