ToolCallParser
Namespace: Vercel.AI.GenerateText
public static class ToolCallParserParses the input of a tool call and validates it against the tool’s input schema. Maps to parseToolCall.
Inheritance: object
Methods
Section titled “Methods”ParseToolCallAsync(ParseToolCallOptions, CancellationToken)
Section titled “ParseToolCallAsync(ParseToolCallOptions, CancellationToken)”public static Task<ParsedToolCall> ParseToolCallAsync(ParseToolCallOptions options, CancellationToken cancellationToken = default)Parses the call in <code class=“paramref”>options</code>. Empty input is validated as an empty object. A call that cannot be parsed comes back with Invalid set and the failure in Error: a NoSuchToolError, an InvalidToolInputError, or a ToolCallRepairError when RepairToolCall failed. A failing repair never hides a cancellation: when <code class=“paramref”>cancellationToken</code> is cancelled the task is cancelled.
Parameters
| Name | Type | Description |
|---|---|---|
options |
ParseToolCallOptions | |
cancellationToken |
CancellationToken |
Returns: Task<ParsedToolCall>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product