@@ -50,15 +50,12 @@ def __init__(self, inputs):
5050 api_key = self .inputs ["anthropic_api_key" ],
5151 )
5252
53- gifs_base_path = os .path .join (os .path .dirname (__file__ ), "../../../tmp/gifs" )
54- if not os .path .exists (gifs_base_path ):
55- os .makedirs (gifs_base_path )
56-
5753 # Configure GIF generation for debugging/visualization
58- self .generate_gif = (
59- f"{ gifs_base_path } /agent_history_{ datetime .now ().strftime ('%Y-%m-%d_%H-%M-%S' )} .gif"
60- if ("generate_gif" in self .inputs and self .inputs ["generate_gif" ])
61- or ("debug" in self .inputs and self .inputs ["debug" ])
54+ self .gif_path = (
55+ self .inputs .get ("gif_path" , None )
56+ if "gif_path" in self .inputs
57+ else os .path .join (os .getcwd (), f"agent_history_{ datetime .now ().strftime ('%Y-%m-%d_%H-%M-%S' )} .gif" )
58+ if ("debug" in self .inputs and self .inputs ["debug" ])
6259 else False
6360 )
6461
@@ -91,7 +88,7 @@ def run(self) -> dict:
9188 controller = controller ,
9289 task = mustache_render (self .inputs ["task" ], self .inputs ["task_value" ]),
9390 llm = self .llm ,
94- generate_gif = self .generate_gif ,
91+ generate_gif = self .gif_path ,
9592 validate_output = True ,
9693 initial_actions = self .inputs .get ("initial_actions" , None ),
9794 use_vision = self .inputs .get ("use_vision" , True ),
@@ -117,7 +114,7 @@ def run(self) -> dict:
117114 return {
118115 "history" : self .history ,
119116 "result" : self .history .final_result (),
120- "generated_gif" : self .generate_gif ,
117+ "generated_gif" : self .gif_path ,
121118 }
122119
123120 def __format_history_as_json (self ):
0 commit comments