Skip to content

Commit c347aa8

Browse files
Feedback to invalid actions (#29)
* feat: add feedback option in config * chore: remove explicit action (already present in previous action message)\ * chore: clearer feedback
1 parent 301dc5a commit c347aa8

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

balrog/config/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ eval:
2323
save_images: False # Whether to save images from the environment
2424
icl_episodes: 1
2525
icl_dataset: records
26+
feedback_on_invalid_action : True # Whether to provide feedback on invalid actions
2627

2728
client:
2829
client_name: openai # LLM client to use (e.g., 'openai', 'gemini', 'claude')

balrog/evaluator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ def run_episode(self, task, agent, process_num=None, position=0, episode_idx=0):
321321

322322
# Give feedback on the action (if not valid)
323323
obs["text"]["long_term_context"] = (
324-
f"\n\nYour previous output action: '{response.completion}' is not a valid action. Defaulted to action: {action}\n"
324+
f"\n\nYour previous output did not contain a valid action. Defaulted to action: {action}\n\nObservation:\n"
325325
+ obs["text"]["long_term_context"]
326-
if action != response.completion
326+
if (action != response.completion) and (self.config.eval.feedback_on_invalid_action)
327327
else obs["text"]["long_term_context"]
328328
)
329329
action = response.completion

0 commit comments

Comments
 (0)