ChatRole Struct

Definition

Describes the intended purpose of a message within a chat completion interaction.

[System.Text.Json.Serialization.JsonConverter(typeof(Microsoft.Extensions.AI.ChatRole+Converter))]
public readonly struct ChatRole : IEquatable<Microsoft.Extensions.AI.ChatRole>
Inheritance
ChatRole
Attributes
Implements

Constructors

ChatRole(String)

Initializes a new instance of the ChatRole struct with the provided value.

Properties

Assistant

Gets the role that provides responses to system-instructed, user-prompted input.

System

Gets the role that instructs or sets the behavior of the assistant.

Tool

Gets the role that provides additional information and references for chat completions.

User

Gets the role that provides input for chat completions.

Value

Gets the value associated with this ChatRole.

Methods

Equals(ChatRole)

Indicates whether the current object is equal to another object of the same type.

Equals(Object)

Indicates whether this instance and a specified object are equal.

GetHashCode()

Returns the hash code for this instance.

ToString()

Returns the fully qualified type name of this instance.

Operators

Equality(ChatRole, ChatRole)

Returns a value indicating whether two ChatRole instances are equivalent, as determined by a case-insensitive comparison of their values.

Inequality(ChatRole, ChatRole)

Returns a value indicating whether two ChatRole instances are not equivalent, as determined by a case-insensitive comparison of their values.

Applies to

Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)