Skip to content

Base structure run driver

BaseStructureRunDriver

Bases: ABC

Base class for Structure Run Drivers.

Attributes:

Name Type Description
env dict[str, str]

Environment variables to set before running the Structure.

Source code in griptape/drivers/structure_run/base_structure_run_driver.py
@define
class BaseStructureRunDriver(ABC):
    """Base class for Structure Run Drivers.

    Attributes:
        env: Environment variables to set before running the Structure.
    """

    env: dict[str, str] = field(default=Factory(dict), kw_only=True)

    def run(self, *args: BaseArtifact) -> BaseArtifact:
        return self.try_run(*args)

    @abstractmethod
    def try_run(self, *args: BaseArtifact) -> BaseArtifact: ...

env: dict[str, str] = field(default=Factory(dict), kw_only=True) class-attribute instance-attribute

run(*args)

Source code in griptape/drivers/structure_run/base_structure_run_driver.py
def run(self, *args: BaseArtifact) -> BaseArtifact:
    return self.try_run(*args)

try_run(*args) abstractmethod

Source code in griptape/drivers/structure_run/base_structure_run_driver.py
@abstractmethod
def try_run(self, *args: BaseArtifact) -> BaseArtifact: ...