Skip to content

Commit

Permalink
Merge pull request #63 from small-thinking/fix-tool-2
Browse files Browse the repository at this point in the history
Fix tool 2
  • Loading branch information
yxjiang authored Mar 31, 2024
2 parents 1974e79 + 6a3220f commit fd84561
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions polymind/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ def _validate_input_message(self, input_message: Message) -> None:
}
concrete_type = type_mapping.get(base_type, base_type)
if not isinstance(input_message.content[param.name], concrete_type):
raise ValueError(f"{self.tool_name}: The field '{param.name}' must be of type '{param.type}'.")
raise ValueError(
f"{self.tool_name}: The field '{param.name}' must be of type '{param.type}',"
f" but is '{type(input_message.content[param.name])}'."
)

@abstractmethod
def output_spec(self) -> List[Param]:
Expand Down Expand Up @@ -210,7 +213,10 @@ def _validate_output_message(self, output_message: Message) -> None:
}
concrete_type = type_mapping.get(base_type, base_type)
if not isinstance(output_message.content[param.name], concrete_type):
raise ValueError(f"{self.tool_name}: The field '{param.name}' must be of type '{param.type}'.")
raise ValueError(
f"{self.tool_name}: The field '{param.name}' must be of type '{param.type}',"
f" but is '{type(output_message.content[param.name])}'."
)

@abstractmethod
async def _execute(self, input: Message) -> Message:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "polymind"
version = "0.0.34" # Update this version before publishing to PyPI
version = "0.0.35" # Update this version before publishing to PyPI
description = "PolyMind is a customizable collaborative multi-agent framework for collective intelligence and distributed problem solving."
authors = ["TechTao"]
license = "MIT License"
Expand Down

0 comments on commit fd84561

Please sign in to comment.