Skip to content

Commit

Permalink
Changed type for additional instructions in send message tool to str
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Oct 17, 2024
1 parent 9674363 commit d76aac2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions agency_swarm/agency/agency.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,8 +1051,8 @@ class SendMessage(BaseTool):
message_files: Optional[List[str]] = Field(default=None,
description="A list of file ids to be sent as attachments to this message. Only use this if you have the file id that starts with 'file-'.",
examples=["file-1234", "file-5678"])
additional_instructions: Optional[List[str]] = Field(default=None,
description="Any additional instructions or clarifications that you would like to provide to the recipient agent.")
additional_instructions: Optional[str] = Field(default=None,
description="Additional context or instructions for the recipient agent about the task. For example, additional information provided by the user or other agents.")

class ToolConfig:
strict = False
Expand All @@ -1066,10 +1066,18 @@ def validate_files(self):
raise ValueError("You must include file ids in message_files parameter.")

@field_validator('recipient')
@classmethod
def check_recipient(cls, value):
if value.value not in recipient_names:
raise ValueError(f"Recipient {value} is not valid. Valid recipients are: {recipient_names}")
return value

@field_validator('additional_instructions', mode='before')
@classmethod
def validate_additional_instructions(cls, value):
if isinstance(value, list):
return "\n".join(value)
return value

def run(self):
thread = outer_self.agents_and_threads[self._caller_agent.name][self.recipient.value]
Expand Down

0 comments on commit d76aac2

Please sign in to comment.