(toolbench_code_string, toolbench_api_name, toolbench_input_params_str)
| 77 | return return_dict, save_cache_flag, switch_flag |
| 78 | |
| 79 | def run(toolbench_code_string, toolbench_api_name, toolbench_input_params_str): |
| 80 | # get observation |
| 81 | success_flag = False |
| 82 | switch_flag = False |
| 83 | save_cache = False |
| 84 | exec(toolbench_code_string) |
| 85 | try: |
| 86 | eval_func_str = f"{toolbench_api_name}({toolbench_input_params_str})" |
| 87 | new_func = eval(eval_func_str) |
| 88 | response, save_cache, switch_flag = process_error(new_func) |
| 89 | success_flag = True |
| 90 | except Exception as e: |
| 91 | response = {"error": f"Function executing {toolbench_code_string} error...\n{e}", "response": ""} |
| 92 | save_cache = False |
| 93 | return success_flag, switch_flag, response, save_cache |
| 94 | |
| 95 | |
| 96 | def dict_shorten(origin: dict, schema: dict): |
no test coverage detected