tool#
Bases: BaseTool “)
Attributes#
Name |
Type |
Description |
|---|---|---|
<a href="tool.mdx#griptape.tools.structure_run.tool.StructureRunTool.description" title="description = field(kw_only=True, metadata={'serializable': True}) class-attribute instance-attribute (griptape.tools.structure_run.tool.StructureRunTool.description)"><code class="language-python">description</code></a> |
str |
A description of what the Structure does.<br/> |
<a href="tool.mdx#griptape.tools.structure_run.tool.StructureRunTool.structure_run_driver" title="structure_run_driver = field(kw_only=True, metadata={'serializable': True}) class-attribute instance-attribute (griptape.tools.structure_run.tool.StructureRunTool.structure_run_driver)"><code class="language-python">structure_run_driver</code></a> |
<a href="../../drivers/structure_run#griptape.drivers.structure_run.BaseStructureRunDriver" title="BaseStructureRunDriver (griptape.drivers.structure_run.BaseStructureRunDriver)"><code class="language-python">BaseStructureRunDriver</code></a> |
Driver to run the Structure.<br/> |
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.
structure_run_driver: Driver to run the Structure.
"""
description: str = field(kw_only=True, metadata={"serializable": True})
structure_run_driver: BaseStructureRunDriver = field(kw_only=True, metadata={"serializable": True})
@activity(
config={
"description": "Can be used to run a Gen AI Builder 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.structure_run_driver.run(*[TextArtifact(arg) for arg in args])
description = field(kw_only=True, metadata={'serializable': True})class-attribute instance-attributestructure_run_driver = field(kw_only=True, metadata={'serializable': True})class-attribute instance-attribute
run_structure(params)#
Source Code in griptape/tools/structure_run/tool.py
@activity(
config={
"description": "Can be used to run a Gen AI Builder 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.structure_run_driver.run(*[TextArtifact(arg) for arg in args])