Bases: BaseTool
Tool for running a Structure.
Attributes:
Source code in griptape/tools/structure_run/tool.py
| @define
class StructureRunTool(BaseTool):
"""Tool for running a Structure.
Attributes:
description: A description of what the Structure does.
driver: Driver to run the Structure.
"""
description: str = field(kw_only=True)
driver: BaseStructureRunDriver = field(kw_only=True)
@activity(
config={
"description": "Can be used to run a Griptape Structure with the following description: {{ _self.description }}",
"schema": Schema(
{
Literal("args", description="A list of string arguments to submit to the Structure Run"): Schema(
[str]
)
},
),
},
)
def run_structure(self, params: dict) -> BaseArtifact:
args: list[str] = params["values"]["args"]
return self.driver.run(*[TextArtifact(arg) for arg in args])
|
Source code in griptape/tools/structure_run/tool.py
| @activity(
config={
"description": "Can be used to run a Griptape Structure with the following description: {{ _self.description }}",
"schema": Schema(
{
Literal("args", description="A list of string arguments to submit to the Structure Run"): Schema(
[str]
)
},
),
},
)
def run_structure(self, params: dict) -> BaseArtifact:
args: list[str] = params["values"]["args"]
return self.driver.run(*[TextArtifact(arg) for arg in args])
|