One tool as the OpenAI Chat Completions API takes it.
A definition only. Toolset.toOpenAI builds the array to pass as
tools, and every tool_call that comes back goes to Toolset.call,
whose text becomes the content of the { role: 'tool' } message you send
in reply.
That API delivers tool_call.function.arguments as a JSON string rather
than an object. Toolset.call takes it as it arrives — it parses a
string and reports unparseable text the way it reports any other bad
argument, so there is nothing to unwrap first.
// Each tool_call carries a name and its arguments as JSON text: asyncfunctioncalled(name: string, args: string) { consttext = awaittoolset.call(name, args) // text -> the content of a { role: 'tool', tool_call_id } message }
One tool as the OpenAI Chat Completions API takes it.
A definition only. Toolset.toOpenAI builds the array to pass as
tools, and everytool_callthat comes back goes to Toolset.call, whose text becomes thecontentof the{ role: 'tool' }message you send in reply.That API delivers
tool_call.function.argumentsas a JSON string rather than an object. Toolset.call takes it as it arrives — it parses a string and reports unparseable text the way it reports any other bad argument, so there is nothing to unwrap first.Example