cutting a new version addressin backward compatibility

This commit is contained in:
João Moura
2024-02-28 12:03:43 -03:00
parent 5857c22daf
commit 78bf008c36
5 changed files with 33 additions and 8 deletions

View File

@@ -256,9 +256,10 @@ class Agent(BaseModel):
def interpolate_inputs(self, inputs: Dict[str, Any]) -> None:
"""Interpolate inputs into the agent description and backstory."""
self.role = self.role.format(**inputs)
self.goal = self.goal.format(**inputs)
self.backstory = self.backstory.format(**inputs)
if inputs:
self.role = self.role.format(**inputs)
self.goal = self.goal.format(**inputs)
self.backstory = self.backstory.format(**inputs)
def increment_formatting_errors(self) -> None:
"""Count the formatting errors of the agent."""

View File

@@ -70,7 +70,7 @@ class Crew(BaseModel):
)
inputs: Optional[Dict[str, Any]] = Field(
description="Any inputs that the crew will use in tasks or agents, it will be interpolated in promtps.",
default={},
default=None,
)
config: Optional[Union[Json, Dict[str, Any]]] = Field(default=None)
id: UUID4 = Field(default_factory=uuid.uuid4, frozen=True)

View File

@@ -175,9 +175,10 @@ class Task(BaseModel):
def interpolate_inputs(self, inputs: Dict[str, Any]) -> None:
"""Interpolate inputs into the task description and expected output."""
self.description = self.description.format(**inputs)
if self.expected_output:
self.expected_output = self.expected_output.format(**inputs)
if inputs:
self.description = self.description.format(**inputs)
if self.expected_output:
self.expected_output = self.expected_output.format(**inputs)
def increment_tools_errors(self) -> None:
"""Increment the tools errors counter."""