File tree Expand file tree Collapse file tree 1 file changed +33
-16
lines changed Expand file tree Collapse file tree 1 file changed +33
-16
lines changed Original file line number Diff line number Diff line change @@ -90,24 +90,41 @@ defs:
9090 stop: ["\n", "Obs:", "<|eom_id|>"]
9191 include_stop_sequence: false
9292 spec: { name: string, arguments: object }
93- - if: ${ action == prev_action or action.name.lower() == "finish" }
94- then:
95- defs:
96- exit:
97- data: true
98- else:
99- def: observation
100- text:
101- - "\nObs: "
102- - if: ${ action.name.lower() in tools }
103- then:
104- call: ${ tools[action.name.lower()] }
93+ fallback:
94+ data:
95+ name: error
96+ arguments: failed to generate a valid action
97+ - match: ${ action.name.lower() }
98+ with:
99+ - case: finish
100+ then:
101+ def: exit
102+ data: true
103+ contribute: []
104+ - if: ${ action == prev_action }
105+ then:
106+ def: exit
107+ data: true
108+ contribute: []
109+ - if: ${ action.name.lower() in tools }
110+ then:
111+ def: observation
112+ text:
113+ - "\nObs: "
114+ - call: ${ tools[action.name.lower()] }
105115 args:
106116 arguments: ${ action.arguments }
107- else: "Invalid action. Valid actions are ${ tool_names[:-1]|join(', ') }, and ${ tool_names[-1] }."
117+ - then:
118+ def: observation
119+ text:
120+ - "\nObs: "
121+ - "Invalid action. Valid actions are ${ tool_names[:-1]|join(', ') }, and ${ tool_names[-1] }."
122+
108123 - defs:
109- prev_action:
110- data: ${ action }
124+ prev_action: ${ action }
111125 until: ${ exit }
112126 - data:
113- answer: ${ (action.arguments.answer|default("No answer found."))|trim }
127+ answer: ${ action.arguments.answer | trim }
128+ fallback:
129+ data:
130+ answer: "No answer found."
You can’t perform that action at this time.
0 commit comments