[BFCL] resolve_ast_by_type 将每个单项运算符解码为否定运算符,因此 +3 和 ~3 都被读作 -3
berkeley-function-call-leaderboard/bfcl_eval/model_handler/utils.py:333-334 (HEAD 6ea5797, same as current main):
elif isinstance(value, ast.UnaryOp):
output = -value.operand.valueThis branch never reads value.op. Every ast.UnaryOp (+x, -x, ~x, not x) is decoded as arithmetic negation of a bare constant. -5 comes out right, and that is the only case the line handles. +5, ~5 and not True all decode to negative numbers. If the operand is not a plain constant (-(2+3), - -5, -y), decoding raises AttributeError, because the operand node has no .value.
ast_parse reaches this code through resolve_ast_call. ast_parse is used by default_decode_ast_prompting and default_decode_execute_prompting, which serve base_oss_handler and the prompt-mode paths of the Claude, Gemini, Mistral, nemotron, nvidia, openai_completion and openai_response handlers. ast_parse is also called directly from decode_ast / decode_execute in api_inference/gorilla.py and api_inference/nexus.py. local_inference/minicpm_fc.py:319 calls resolve_ast_call itself, which then reaches resolve_ast_by_type. No test in the repository covers this branch. Function-calling handlers that receive JSON arguments are not affected, because +5 is not valid JSON.
内容来源: ShishirPatil/gorilla