Compartir a través de


ChatCompletion<T> Class

Definition

Represents the result of a chat completion request with structured output.

generic <typename T>
public ref class ChatCompletion : Microsoft::Extensions::AI::ChatCompletion
public class ChatCompletion<T> : Microsoft.Extensions.AI.ChatCompletion
type ChatCompletion<'T> = class
    inherit ChatCompletion
Public Class ChatCompletion(Of T)
Inherits ChatCompletion

Type Parameters

T

The type of value expected from the chat completion.

Inheritance
ChatCompletion<T>

Remarks

Language models are not guaranteed to honor the requested schema. If the model's output is not parseable as the expected type, then TryGetResult(T) will return false. You can access the underlying JSON response on the Message property.

Constructors

ChatCompletion<T>(ChatCompletion, JsonSerializerOptions)

Initializes a new instance of the ChatCompletion<T> class.

Properties

AdditionalProperties

Gets or sets any additional properties associated with the chat completion.

(Inherited from ChatCompletion)
Choices

Gets or sets the list of chat completion choices.

(Inherited from ChatCompletion)
CompletionId

Gets or sets the ID of the chat completion.

(Inherited from ChatCompletion)
CreatedAt

Gets or sets a timestamp for the chat completion.

(Inherited from ChatCompletion)
FinishReason

Gets or sets the reason for the chat completion.

(Inherited from ChatCompletion)
Message

Gets the chat completion message.

(Inherited from ChatCompletion)
ModelId

Gets or sets the model ID used in the creation of the chat completion.

(Inherited from ChatCompletion)
RawRepresentation

Gets or sets the raw representation of the chat completion from an underlying implementation.

(Inherited from ChatCompletion)
Result

Gets the result of the chat completion as an instance of T. If the response did not contain JSON, or if deserialization fails, this property will throw. To avoid exceptions, use TryGetResult(T) instead.

Usage

Gets or sets usage details for the chat completion.

(Inherited from ChatCompletion)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from ChatCompletion)
TryGetResult(T)

Attempts to deserialize the result to produce an instance of T.

Applies to