diff --git a/config/config2.example.yaml b/config/config2.example.yaml index a7214f662..2a0ebcc47 100644 --- a/config/config2.example.yaml +++ b/config/config2.example.yaml @@ -81,6 +81,8 @@ exp_pool: persist_path: .chroma_exp_data # The directory. retrieval_type: bm25 # Default is `bm25`, can be set to `chroma` for vector storage, which requires setting up embedding. use_llm_ranker: true # Default is `true`, it will use LLM Reranker to get better result. + collection_name: experience_pool # When `retrieval_type` is `chroma`, `collection_name` is the collection name in chromadb. + azure_tts_subscription_key: "YOUR_SUBSCRIPTION_KEY" azure_tts_region: "eastus" diff --git a/metagpt/configs/exp_pool_config.py b/metagpt/configs/exp_pool_config.py index 8d33b25aa..a4a2d5d41 100644 --- a/metagpt/configs/exp_pool_config.py +++ b/metagpt/configs/exp_pool_config.py @@ -22,3 +22,4 @@ class ExperiencePoolConfig(YamlModel): default=ExperiencePoolRetrievalType.BM25, description="The retrieval type for experience pool." ) use_llm_ranker: bool = Field(default=True, description="Use LLM Reranker to get better result.") + collection_name: str = Field(default="experience_pool", description="The collection name in chromadb") diff --git a/metagpt/exp_pool/manager.py b/metagpt/exp_pool/manager.py index e38906d90..2d50b052f 100644 --- a/metagpt/exp_pool/manager.py +++ b/metagpt/exp_pool/manager.py @@ -7,12 +7,7 @@ from pydantic import BaseModel, ConfigDict, Field from metagpt.config2 import Config from metagpt.configs.exp_pool_config import ExperiencePoolRetrievalType -from metagpt.exp_pool.schema import ( - DEFAULT_COLLECTION_NAME, - DEFAULT_SIMILARITY_TOP_K, - Experience, - QueryType, -) +from metagpt.exp_pool.schema import DEFAULT_SIMILARITY_TOP_K, Experience, QueryType from metagpt.logs import logger from metagpt.utils.exceptions import handle_exception @@ -166,7 +161,7 @@ class ExperienceManager(BaseModel): retriever_configs = [ ChromaRetrieverConfig( persist_path=self.config.exp_pool.persist_path, - collection_name=DEFAULT_COLLECTION_NAME, + collection_name=self.config.exp_pool.collection_name, similarity_top_k=DEFAULT_SIMILARITY_TOP_K, ) ] diff --git a/metagpt/exp_pool/schema.py b/metagpt/exp_pool/schema.py index b119e5850..a45910f0d 100644 --- a/metagpt/exp_pool/schema.py +++ b/metagpt/exp_pool/schema.py @@ -7,7 +7,6 @@ from pydantic import BaseModel, Field MAX_SCORE = 10 -DEFAULT_COLLECTION_NAME = "experience_pool" DEFAULT_SIMILARITY_TOP_K = 2 diff --git a/metagpt/schema.py b/metagpt/schema.py index 8ef7dd0bb..5f9a5667f 100644 --- a/metagpt/schema.py +++ b/metagpt/schema.py @@ -148,7 +148,7 @@ class SerializationMixin(BaseModel, extra="forbid"): serialized_data = self.model_dump() write_json_file(file_path, serialized_data) - logger.info(f"{self.__class__.__qualname__} serialization successful. File saved at: {file_path}") + logger.debug(f"{self.__class__.__qualname__} serialization successful. File saved at: {file_path}") return file_path @@ -171,7 +171,7 @@ class SerializationMixin(BaseModel, extra="forbid"): data: dict = read_json_file(file_path) model = cls(**data) - logger.info(f"{cls.__qualname__} deserialization successful. Instance created from file: {file_path}") + logger.debug(f"{cls.__qualname__} deserialization successful. Instance created from file: {file_path}") return model