ToolUIPart
Namespace: Vercel.AI.Ui
public sealed class ToolUIPart : UIMessagePartA tool invocation part. Its type is tool-{name}, or dynamic-tool for a tool whose name is not known up front.
Maps to ToolUIPart and DynamicToolUIPart.
Inheritance: object → UIMessagePart
Constructors
Section titled “Constructors”ToolUIPart(string, string, ToolUIPartState, bool)
Section titled “ToolUIPart(string, string, ToolUIPartState, bool)”public ToolUIPart(string toolName, string toolCallId, ToolUIPartState state, bool isDynamic = false)Creates a tool part for the tool <code class=“paramref”>toolName</code>.
Parameters
| Name | Type | Description |
|---|---|---|
toolName |
string | |
toolCallId |
string | |
state |
ToolUIPartState | |
isDynamic |
bool |
Properties
Section titled “Properties”Approval
Section titled “Approval”public ToolUIApproval? Approval { get; init; }The approval of the call.
Value: ToolUIApproval
CallProviderMetadata
Section titled “CallProviderMetadata”public IReadOnlyDictionary<string, JsonElement>? CallProviderMetadata { get; init; }The provider metadata of the call.
Value: IReadOnlyDictionary<string, JsonElement>
Dynamic
Section titled “Dynamic”public bool? Dynamic { get; init; }For a dynamic-tool part, false when the part came from a static tool that is no longer available.
Maps to dynamic: false.
Value: bool?
ErrorText
Section titled “ErrorText”public string? ErrorText { get; init; }The error text of a failed call.
Value: string
public JsonElement? Input { get; init; }The tool input. Null when it is undefined.
Value: JsonElement?
IsDynamic
Section titled “IsDynamic”public bool IsDynamic { get; }True for a dynamic-tool part.
Value: bool
Output
Section titled “Output”public JsonElement? Output { get; init; }The tool output. Null when it is undefined.
Value: JsonElement?
Preliminary
Section titled “Preliminary”public bool? Preliminary { get; init; }True when the output is a preliminary result.
Value: bool?
ProviderExecuted
Section titled “ProviderExecuted”public bool? ProviderExecuted { get; init; }Whether the provider executed the tool.
Value: bool?
RawInput
Section titled “RawInput”public JsonElement? RawInput { get; init; }The raw input of a failed or streaming call.
Value: JsonElement?
ResultProviderMetadata
Section titled “ResultProviderMetadata”public IReadOnlyDictionary<string, JsonElement>? ResultProviderMetadata { get; init; }The provider metadata of the result.
Value: IReadOnlyDictionary<string, JsonElement>
public ToolUIPartState State { get; }The state of the invocation.
Value: ToolUIPartState
public string? Title { get; init; }The title of the tool.
Value: string
ToolCallId
Section titled “ToolCallId”public string ToolCallId { get; }The tool call id.
Value: string
ToolName
Section titled “ToolName”public string ToolName { get; }The tool name.
Value: string
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product