in aidial_adapter_bedrock/llm/tools/claude_protocol.py [0:0]
def _parse_function_call(text: str) -> FunctionCall:
start_index = text.find(FUNC_START_TAG)
if start_index == -1:
raise Exception(
f"Unable to parse function call, missing {FUNC_TAG_NAME!r} tag"
)
try:
dict = parse_xml(text[start_index:])
invocation = dict[FUNC_TAG_NAME]["invoke"]
tool_name = invocation["tool_name"]
parameters = invocation["parameters"]
except Exception:
raise Exception("Unable to parse function call")
return FunctionCall(name=tool_name, arguments=json.dumps(parameters))