2026-11-10 · America/Los_Angeles · 社区动态 · #11
Do you validate tool call arguments before they reach your function?
The default shape of tool-calling code is roughly this: python args = json.loads(call.function.arguments) result = do_thing(args["path"], args.get("limit", 10)) No schema check. If the model sends "limit": "10", or invents an enum value, the failure surfaces inside do_thing and the model gets back a stack trace it can't act on. Sometimes it doesn't fail at all and quietly does the wrong thing. The alternative is validating against the same JSON Schema you sent the model, and on failure returning the validation error as the tool result instead of raising: json {"error": "invalid_arguments",…
热度 35.7 / 100;排名与评分保留该期记录。