This commit is contained in:
João Moura
2024-12-27 16:53:00 -03:00
parent afeb8ca1ee
commit 842e5fb70a
2 changed files with 4 additions and 4 deletions

View File

@@ -18,8 +18,8 @@ class AddImageToolSchema(BaseModel):
class AddImageTool(BaseTool): class AddImageTool(BaseTool):
"""Tool for adding images to the content""" """Tool for adding images to the content"""
name: str = Field(default_factory=lambda: i18n.tools("add_image")["name"]) name: str = Field(default_factory=lambda: i18n.tools("add_image")["name"]) # type: ignore
description: str = Field(default_factory=lambda: i18n.tools("add_image")["description"]) description: str = Field(default_factory=lambda: i18n.tools("add_image")["description"]) # type: ignore
args_schema: type[BaseModel] = AddImageToolSchema args_schema: type[BaseModel] = AddImageToolSchema
def _run( def _run(
@@ -28,7 +28,7 @@ class AddImageTool(BaseTool):
action: Optional[str] = None, action: Optional[str] = None,
**kwargs, **kwargs,
) -> dict: ) -> dict:
action = action or i18n.tools("add_image")["default_action"] action = action or i18n.tools("add_image")["default_action"] # type: ignore
content = [ content = [
{"type": "text", "text": action}, {"type": "text", "text": action},
{ {

View File

@@ -104,7 +104,7 @@ class ToolUsage:
self._printer.print(content=f"\n\n{error}\n", color="red") self._printer.print(content=f"\n\n{error}\n", color="red")
return error return error
if isinstance(tool, CrewStructuredTool) and tool.name == self._i18n.tools("add_image")["name"]: if isinstance(tool, CrewStructuredTool) and tool.name == self._i18n.tools("add_image")["name"]: # type: ignore
try: try:
result = self._use(tool_string=tool_string, tool=tool, calling=calling) result = self._use(tool_string=tool_string, tool=tool, calling=calling)
return result return result