Skip to content

Vercel.AI.GenerateText

API reference

Public types in the Vercel.AI.GenerateText namespace.

Type Summary
ActiveToolFilter Active-tool filtering. Maps to filterActiveTools.
ApprovalHistoryMessage A message in the approval history.
ApprovalHistoryPart One part of an approval history message.
ApprovalRequestPart A request that a tool call be approved.
ApprovalResponsePart The caller’s decision for an approval request.
ApprovalToolCallPart A tool call stored in assistant history.
ApprovalToolResultPart A tool result stored beside an approval response.
CanonicalHash Canonical JSON and SHA-256 digests used by tool fingerprints and approval signatures.
CollectedToolApproval One approval that still needs execution or denial handling.
CollectedToolApprovalSet Approved and denied tool approvals from the last tool message.
ContentParts Reads text and reasoning out of generated content. Maps to extractTextContent and extractReasoningContent.
DownloadException A download failed or the URL is not safe to fetch. Maps to DownloadError.
DownloadUrls Rejects unsafe file URLs before a download starts. Maps to validateDownloadUrl.
FingerprintTool A tool definition pinned by FingerprintTool%7d).
GeneratedFileUrl A generated file that still points at a URL.
InvalidToolApprovalException An approval response names an unknown approval id.
JsonInstructions JSON output instructions. Maps to injectJsonInstruction.
MessagePruning Message pruning. Maps to pruneMessages.
NoOutputGeneratedException No LLM output was generated, for example because a model stream ended without output. Maps to NoOutputGeneratedError.
OutputStrategies Array output schema wrapping. Maps to the array branch of getOutputStrategy.
ParsedToolCall A tool call after its input was parsed and validated. Maps to a TypedToolCall.
ParseToolCallOptions Options of CancellationToken). Maps to the options of parseToolCall.
PruneMessagesOptions Options of PruneMessages(PruneMessagesOptions).
PruneToolCallsRule One rule for pruning tool calls, results, errors, and approvals. Maps to an entry of the toolCalls array, { type: ‘all’ | ‘before-last-message’ | ‘before-last-N-messages’, tools }.
TokenCounts Token-count helpers. Maps to sumTokenCounts.
TokenRates Token-rate helpers. Maps to calculateTokensPerSecond.
ToolApprovalCollection Collects tool approvals from the last tool message. Maps to collectToolApprovals.
ToolApprovalSignatures HMAC approval signatures. Maps to signToolApproval and verifyToolApprovalSignature.
ToolCallConcurrencyScheduler Tool call concurrency helpers. Maps to tool-call-concurrency.ts.
ToolCallNotFoundForApprovalException An approval request points at a tool call that is not in the history.
ToolCallParser Parses the input of a tool call and validates it against the tool’s input schema. Maps to parseToolCall.
ToolCallRepairContext Context passed to a ToolCallRepairFunction. Maps to the options of ToolCallRepairFunction.
ToolChoiceViolationException The model response did not satisfy toolChoice. Maps to ToolChoiceViolationError.
ToolContexts Validates tool context. Maps to validateToolContext.
ToolDrift Added, removed, and changed tool names.
ToolExecution Finish-reason checks for the tool loop. Maps to isToolExecutionAllowedFinishReason.
ToolFingerprints Tool-definition fingerprints. Maps to fingerprintTools and detectToolDrift.
ToolValidationContext Where tool-context validation failed.
TypeValidationException Tool context failed schema validation. Maps to TypeValidationError.
Type Summary
JsonInstructionText An optional string that can be omitted, null, or set. Distinguishes a missing argument from null.
Type Summary
PruneEmptyMessages Whether PruneMessages(PruneMessagesOptions) keeps messages whose content is empty after pruning.
PruneReasoning How PruneMessages(PruneMessagesOptions) removes reasoning from assistant messages.
Type Summary
ToolCallRepairFunction Attempts to repair a tool call that failed to parse. Returns the repaired call, or null to keep the error. Maps to ToolCallRepairFunction.

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product