openai.internal._chat_tool_args

(internal) A tool call's `arguments` is a JSON *string* the model produced, so it can be malformed (a truncated call, a model that emitted prose). Degrading to `{}` would hand the runner an empty-argument invocation of a real tool and tell nobody the arguments were discarded, so an undecodable payload is a `ParseFailed` carrying the raw string.

Reference version

Signature

function openai.internal._chat_tool_args(
raw: string,
provider: string
) -> map<string, unknown> throws ai.errors.ParseFailed

(internal) A tool call's arguments is a JSON string the model produced, so it can be malformed (a truncated call, a model that emitted prose). Degrading to {} would hand the runner an empty-argument invocation of a real tool and tell nobody the arguments were discarded, so an undecodable payload is a ParseFailed carrying the raw string.

Source:<builtin>/openai/ns_internal/chat.bamlbytes 4644846688