AssistantModelMessage
Namespace: Vercel.AI.Provider
public sealed class AssistantModelMessage : ModelMessageAn assistant message.
Inheritance: object → ModelMessage
Constructors
Section titled “Constructors”AssistantModelMessage(IReadOnlyList<AssistantContentPart>)
Section titled “AssistantModelMessage(IReadOnlyList<AssistantContentPart>)”public AssistantModelMessage(IReadOnlyList<AssistantContentPart> parts)Creates an assistant message from ordered parts. The text, reasoning, and tool calls are derived from them.
Parameters
| Name | Type | Description |
|---|---|---|
parts |
IReadOnlyList<AssistantContentPart> |
AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?)
Section titled “AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?)”public AssistantModelMessage(string? text, IReadOnlyList<GeneratedToolCall>? toolCalls, string? reasoning)Creates an assistant message.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string | |
toolCalls |
IReadOnlyList<GeneratedToolCall> | |
reasoning |
string |
AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?, IReadOnlyDictionary<string, JsonElement>?)
Section titled “AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?, IReadOnlyDictionary<string, JsonElement>?)”public AssistantModelMessage(string? text, IReadOnlyList<GeneratedToolCall>? toolCalls, string? reasoning, IReadOnlyDictionary<string, JsonElement>? reasoningProviderOptions)Creates an assistant message whose reasoning carries provider options, such as an OpenAI
itemId for reasoning stored by the Responses API.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string | |
toolCalls |
IReadOnlyList<GeneratedToolCall> | |
reasoning |
string | |
reasoningProviderOptions |
IReadOnlyDictionary<string, JsonElement> |
AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?, IReadOnlyDictionary<string, JsonElement>?, IReadOnlyList<AssistantContentPart>?)
Section titled “AssistantModelMessage(string?, IReadOnlyList<GeneratedToolCall>?, string?, IReadOnlyDictionary<string, JsonElement>?, IReadOnlyList<AssistantContentPart>?)”public AssistantModelMessage(string? text, IReadOnlyList<GeneratedToolCall>? toolCalls, string? reasoning, IReadOnlyDictionary<string, JsonElement>? reasoningProviderOptions, IReadOnlyList<AssistantContentPart>? parts)Creates an assistant message that also keeps its content parts in order. When <code class=“paramref”>parts</code> is null, the parts are the reasoning, the text, and the tool calls, in that order.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string | |
toolCalls |
IReadOnlyList<GeneratedToolCall> | |
reasoning |
string | |
reasoningProviderOptions |
IReadOnlyDictionary<string, JsonElement> | |
parts |
IReadOnlyList<AssistantContentPart> |
Properties
Section titled “Properties”public IReadOnlyList<AssistantContentPart> Parts { get; }The content parts in the order the model produced them, each with its own provider options.
Value: IReadOnlyList<AssistantContentPart>
ProviderOptions
Section titled “ProviderOptions”public IReadOnlyDictionary<string, JsonElement>? ProviderOptions { get; init; }Provider-specific options for this message, such as an Amazon Bedrock cachePoint.
Value: IReadOnlyDictionary<string, JsonElement>
Reasoning
Section titled “Reasoning”public string? Reasoning { get; }Reasoning text, when the provider returned it.
Value: string
ReasoningProviderOptions
Section titled “ReasoningProviderOptions”public IReadOnlyDictionary<string, JsonElement>? ReasoningProviderOptions { get; }Provider options of the reasoning part, such as an OpenAI itemId.
Value: IReadOnlyDictionary<string, JsonElement>
public string? Text { get; }Assistant text.
Value: string
ToolCalls
Section titled “ToolCalls”public IReadOnlyList<GeneratedToolCall> ToolCalls { get; }Tool calls made in this turn.
Value: IReadOnlyList<GeneratedToolCall>
Methods
Section titled “Methods”FromGeneratedContent(IReadOnlyList<GeneratedContent>)
Section titled “FromGeneratedContent(IReadOnlyList<GeneratedContent>)”public static AssistantModelMessage FromGeneratedContent(IReadOnlyList<GeneratedContent> content)Creates an assistant message from generated content, keeping order and each part’s provider metadata as its provider options. This is how a generate result is replayed as history. Sources and files have no assistant part and are skipped.
Parameters
| Name | Type | Description |
|---|---|---|
content |
IReadOnlyList<GeneratedContent> |
Returns: AssistantModelMessage
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product