Making config optional with default value as it's WIP and Adding new treatment for wrong agent tool calls

This commit is contained in:
Joao Moura
2023-12-04 23:58:48 -08:00
parent 2ff9ad8a7f
commit 9be65e03d7
4 changed files with 18 additions and 4 deletions

View File

@@ -12,7 +12,6 @@ class Crew(BaseModel):
Class that represents a group of agents, how they should work together and
their tasks.
"""
config: Optional[Json] = Field(description="Configuration of the crew.")
tasks: Optional[List[Task]] = Field(description="List of tasks")
agents: Optional[List[Agent]] = Field(description="List of agents in this crew.")
process: Process = Field(
@@ -23,6 +22,10 @@ class Crew(BaseModel):
description="Verbose mode for the Agent Execution",
default=False
)
config: Optional[Json] = Field(
description="Configuration of the crew.",
default=None
)
@root_validator(pre=True)
def check_config(_cls, values):

View File

@@ -43,9 +43,13 @@ class AgentTools(BaseModel):
def __execute(self, command):
"""Execute the command."""
agent, task, information = command.split("|")
try:
agent, task, information = command.split("|")
except ValueError:
return "Error executing tool. Missing exact 3 pipe (|) separated values."
if not agent or not task or not information:
return "Error executing tool. Missing 3 pipe (|) separated values."
return "Error executing tool. Missing exact 3 pipe (|) separated values."
agent = [available_agent for available_agent in self.agents if available_agent.role == agent]