PromptInput
Namespace: Vercel.AI.Prompt
public sealed class PromptInputThe prompt of a call: a user string or a list of messages. Maps to prompt: string | ModelMessage[].
Inheritance: object
Properties
Section titled “Properties”Messages
Section titled “Messages”public IReadOnlyList<ModelMessage>? Messages { get; }The messages, when the prompt is a message list.
Value: IReadOnlyList<ModelMessage>
public string? Text { get; }The user text, when the prompt is a string.
Value: string
Methods
Section titled “Methods”From(IReadOnlyList<ModelMessage>)
Section titled “From(IReadOnlyList<ModelMessage>)”public static PromptInput From(IReadOnlyList<ModelMessage> messages)Creates a prompt from a message list.
Parameters
| Name | Type | Description |
|---|---|---|
messages |
IReadOnlyList<ModelMessage> |
Returns: PromptInput
From(string)
Section titled “From(string)”public static PromptInput From(string text)Creates a prompt from a user string.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Returns: PromptInput
Operators
Section titled “Operators”implicit operator PromptInput(string)
Section titled “implicit operator PromptInput(string)”public static implicit operator PromptInput(string text)Converts a string to a prompt.
Parameters
| Name | Type | Description |
|---|---|---|
text |
string |
Returns: PromptInput
implicit operator PromptInput(ModelMessage[])
Section titled “implicit operator PromptInput(ModelMessage[])”public static implicit operator PromptInput(ModelMessage[] messages)Converts an array of messages to a prompt.
Parameters
| Name | Type | Description |
|---|---|---|
messages |
ModelMessage\[\] |
Returns: PromptInput
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product