diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py index cad8112d2..a3f7163c3 100644 --- a/metagpt/actions/action.py +++ b/metagpt/actions/action.py @@ -73,7 +73,7 @@ class Action(SerializationMixin, ContextMixin, BaseModel): def _init_with_instruction(cls, values): if "instruction" in values: name = values["name"] - i = values["instruction"] + i = values.pop("instruction") values["node"] = ActionNode(key=name, expected_type=str, instruction=i, example="", schema="raw") return values diff --git a/metagpt/context.py b/metagpt/context.py index 4badafcc4..406be1f53 100644 --- a/metagpt/context.py +++ b/metagpt/context.py @@ -165,7 +165,7 @@ class ContextMixin(BaseModel): @property def llm(self) -> BaseLLM: """Role llm: role llm > context llm""" - # logger.info(f"class:{self.__class__.__name__}, llm: {self._llm}, llm_config: {self._llm_config}") + print(f"class:{self.__class__.__name__}, llm: {self._llm}, llm_config: {self._llm_config}") if self._llm_config and not self._llm: self._llm = self.context.llm(self._llm_config.name, self._llm_config.provider) return self._llm or self.context.llm() diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py index 9c6832d8f..72ee1175b 100644 --- a/metagpt/roles/role.py +++ b/metagpt/roles/role.py @@ -120,7 +120,7 @@ class RoleContext(BaseModel): class Role(SerializationMixin, ContextMixin, BaseModel): """Role/Agent""" - model_config = ConfigDict(arbitrary_types_allowed=True, exclude=["llm"]) + model_config = ConfigDict(arbitrary_types_allowed=True, extra="ignore") name: str = "" profile: str = ""