(string)
| 72 | import json |
| 73 | |
| 74 | def convert_function_call_to_json(string): |
| 75 | try: |
| 76 | tool_calls = [] |
| 77 | x = ast.parse(string) |
| 78 | for tool in x.body: |
| 79 | function_name = tool.value.func.id |
| 80 | function_args = {} |
| 81 | for keyword in tool.value.keywords: |
| 82 | function_args[keyword.arg] = ast.literal_eval(keyword.value) |
| 83 | this_one = {"name": function_name, "arguments": function_args} |
| 84 | tool_calls.append(this_one) |
| 85 | return tool_calls |
| 86 | except Exception: |
| 87 | return [] |
| 88 | import json |
| 89 | |
| 90 | def extract_code_from_arguments(arguments_str): |
nothing calls this directly
no outgoing calls
no test coverage detected