Skip to content

Instructions

Namespace: Vercel.AI.Prompt

public sealed class Instructions

Instructions for a call: a string, one system message, or a list of system messages. Maps to Instructions. A single system message is kept as a one-item Messages list.

Inheritance: object

View source

public IReadOnlyList<SystemModelMessage>? Messages { get; }

The system messages, when the instructions are one or more system messages.

Value: IReadOnlyList<SystemModelMessage>

View source

public string? Text { get; }

The instruction text, when the instructions are a string.

Value: string

View source

public static Instructions From(IReadOnlyList<SystemModelMessage> messages)

Creates instructions from a list of system messages.

Parameters

Name Type Description
messages IReadOnlyList<SystemModelMessage>

Returns: Instructions

View source

public static Instructions From(string text)

Creates instructions from a string.

Parameters

Name Type Description
text string

Returns: Instructions

View source

public static Instructions From(SystemModelMessage message)

Creates instructions from one system message.

Parameters

Name Type Description
message SystemModelMessage

Returns: Instructions

View source

public static implicit operator Instructions(string text)

Converts a string to instructions.

Parameters

Name Type Description
text string

Returns: Instructions

View source

implicit operator Instructions(SystemModelMessage)

Section titled “implicit operator Instructions(SystemModelMessage)”
public static implicit operator Instructions(SystemModelMessage message)

Converts a system message to instructions.

Parameters

Name Type Description
message SystemModelMessage

Returns: Instructions

View source

implicit operator Instructions(SystemModelMessage[])

Section titled “implicit operator Instructions(SystemModelMessage[])”
public static implicit operator Instructions(SystemModelMessage[] messages)

Converts an array of system messages to instructions.

Parameters

Name Type Description
messages SystemModelMessage\[\]

Returns: Instructions

View source

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