Skip to content

Commit

Permalink
Fix Autogen tool conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
whimo committed Sep 23, 2024
1 parent f2484f4 commit 45cebc7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions motleycrew/tools/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ def to_autogen_tool(self) -> Callable:
Returns:
AutoGen tool function.
"""
fields = list(self.tool.args_schema.__fields__.values())
fields = list(self.tool.args_schema.model_fields.items())
if len(fields) != 1:
raise Exception("Multiple input fields are not supported in to_autogen_tool")

field_name = fields[0].name
field_type = fields[0].annotation
field_name, field_info = fields[0]
field_type = field_info.annotation

def autogen_tool_fn(input: field_type) -> str:
return self.invoke({field_name: input})
Expand Down

0 comments on commit 45cebc7

Please sign in to comment.