Open
Description
return FunctionTool(
name=tool_name,
description=tool_desc,
params_json_schema=params_schema,
on_invoke_tool=create_run_function(service_key, service_name),
strict_json_schema=is_service_tool,
)
def create_run_function(service_key: str, service_name: str):
async def run_function(context, params_str: str) -> str:
#当执行多个相同方法名,但是参数不同时,这里无法定位到是哪次调用, 因为该方法无法获取call_id
#When multiple methods with the same name but different parameters are executed, it is impossible to
determine which call it is here because the method cannot obtain the call_id
params = json.loads(params_str)
try:
result = await call_service(service_key=service_key, params=params)
# context.context[call_id]["invoke_status"] = "success"
return json.dumps(result, ensure_ascii=False)
except Exception as e:
# context.context[call_id]["invoke_status"] = "error"
return f"Error executing tool: {str(e)}"
return run_function
Question
当执行多个相同方法名,但是参数不同时,这里无法定位到是哪次调用, 因为该方法无法获取call_id
When multiple methods with the same name but different parameters are executed, it is impossible to determine which call it is here because the method cannot obtain the call_id