local#
__all__ = ['LocalStructureRunDriver']module-attribute
Bases: BaseStructureRunDriver “)
Source Code in
griptape/drivers/structure_run/local_structure_run_driver.py
@define
class LocalStructureRunDriver(BaseStructureRunDriver):
create_structure: Callable[[], Structure] = field(kw_only=True)
def try_run(self, *args: BaseArtifact) -> BaseArtifact:
old_env = os.environ.copy()
try:
os.environ.update(self.env)
structure = self.create_structure().run(*[arg.value for arg in args])
finally:
os.environ.clear()
os.environ.update(old_env)
return structure.output
create_structure = field(kw_only=True)class-attribute instance-attribute
try_run(*args)#
Source Code in
griptape/drivers/structure_run/local_structure_run_driver.py
def try_run(self, *args: BaseArtifact) -> BaseArtifact:
old_env = os.environ.copy()
try:
os.environ.update(self.env)
structure = self.create_structure().run(*[arg.value for arg in args])
finally:
os.environ.clear()
os.environ.update(old_env)
return structure.output