From a21e8fac5a17667615858a37c28ddececc843f4c Mon Sep 17 00:00:00 2001 From: pooruss Date: Wed, 16 Aug 2023 19:08:59 +0800 Subject: [PATCH] debug rapidapi.py --- toolbench/inference/Downstream_tasks/rapidapi.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/toolbench/inference/Downstream_tasks/rapidapi.py b/toolbench/inference/Downstream_tasks/rapidapi.py index 4e88c05..415579f 100644 --- a/toolbench/inference/Downstream_tasks/rapidapi.py +++ b/toolbench/inference/Downstream_tasks/rapidapi.py @@ -43,12 +43,13 @@ def get_white_list(tool_root_dir): return white_list def contain(candidate_list, white_list): - output = [] + output = set() for cand in candidate_list: - if cand not in white_list.keys(): + if cand in white_list: + output.add(white_list[cand]) + else: return False - output.append(white_list[cand]) - return output + return list(output) @@ -326,7 +327,7 @@ def _step(self, action_name="", action_input=""): self.success = 1 # succesfully return final_answer return "{\"response\":\"successfully giving the final answer.\"}", 3 else: - "{error:\"\"return_type\" is not a valid choice\"}", 2 + return "{error:\"\"return_type\" is not a valid choice\"}", 2 else: for k, function in enumerate(self.functions):