Bases: BaseTool

Attributes

NameTypeDescription
descriptionstrA description of what the Structure does.
structure_run_driverBaseStructureRunDriverDriver to run the Structure.
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-attribute

  • structure_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])

Could this page be better? Report a problem or suggest an addition!