MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / convert_function_call_to_json

Function convert_function_call_to_json

utils/output_parser.py:74–87  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

72import json
73
74def 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 []
88import json
89
90def extract_code_from_arguments(arguments_str):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected