extra='ignore'

This commit is contained in:
geekan 2024-01-10 17:17:27 +08:00
parent 4003f124bb
commit 9a95bcd6e9
3 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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()

View file

@ -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 = ""