m-ric HF Staff commited on
Commit
e077aba
·
1 Parent(s): 379f8cb

Add repetition warning

Browse files
Files changed (2) hide show
  1. app.py +1 -0
  2. e2bqwen.py +7 -0
app.py CHANGED
@@ -576,6 +576,7 @@ with gr.Blocks(theme=theme, css=custom_css, js=custom_js) as demo:
576
  "Write 'Hello World' in a text editor",
577
  "Search a flight Paris - Berlin for tomorrow",
578
  "Search for Château de Fontainebleau in Google Maps",
 
579
  "Download me a picture of a puppy from Google, then head to Hugging Face, find a Space dedicated to background removal, and use it to remove the puppy picture's background"
580
  ],
581
  inputs = task_input,
 
576
  "Write 'Hello World' in a text editor",
577
  "Search a flight Paris - Berlin for tomorrow",
578
  "Search for Château de Fontainebleau in Google Maps",
579
+ "What is the picture that appeared on the very first version of the english Wikipedia page for the Palace of Fontainebleau?",
580
  "Download me a picture of a puppy from Google, then head to Hugging Face, find a Space dedicated to background removal, and use it to remove the puppy picture's background"
581
  ],
582
  inputs = task_input,
e2bqwen.py CHANGED
@@ -406,6 +406,13 @@ class E2BVisionAgent(CodeAgent):
406
  ):
407
  previous_memory_step.observations_images = None
408
 
 
 
 
 
 
 
 
409
  # Add to the current memory step
410
  memory_step.observations_images = [image.copy()]
411
 
 
406
  ):
407
  previous_memory_step.observations_images = None
408
 
409
+ if (
410
+ isinstance(previous_memory_step, ActionStep)
411
+ and previous_memory_step.step_number <= current_step - 1
412
+ ):
413
+ if previous_memory_step.tool_calls[0].arguments == memory_step.tool_calls[0].arguments:
414
+ memory_steps.observations += "\nWARNING: You've executed the same action several times in a row. MAKE SURE TO NOT USELESSLY REPEAT ACTIONS."
415
+
416
  # Add to the current memory step
417
  memory_step.observations_images = [image.copy()]
418