Share via


ChatResponse Class

Definition

Represents the response to a chat request.

public ref class ChatResponse
public class ChatResponse
type ChatResponse = class
Public Class ChatResponse
Inheritance
ChatResponse
Derived

Remarks

ChatResponse provides one or more response messages and metadata about the response. A typical response will contain a single message, however a response might contain multiple messages in a variety of scenarios. For example, if automatic function calling is employed, such that a single request to a IChatClient might actually generate multiple round-trips to an inner IChatClient it uses, all of the involved messages might be surfaced as part of the final ChatResponse.

Constructors

Name Description
ChatResponse()

Initializes a new instance of the ChatResponse class.

ChatResponse(ChatMessage)

Initializes a new instance of the ChatResponse class.

ChatResponse(IList<ChatMessage>)

Initializes a new instance of the ChatResponse class.

Properties

Name Description
AdditionalProperties

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

ContinuationToken

Gets or sets the continuation token for getting result of the background chat response.

ConversationId

Gets or sets an identifier for the state of the conversation.

CreatedAt

Gets or sets a timestamp for the chat response.

FinishReason

Gets or sets the reason for the chat response.

Messages

Gets or sets the chat response messages.

ModelId

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

RawRepresentation

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

ResponseId

Gets or sets the ID of the chat response.

Text

Gets the text of the response.

Usage

Gets or sets usage details for the chat response.

Methods

Name Description
ToChatResponseUpdates()

Creates an array of ChatResponseUpdate instances that represent this ChatResponse.

ToString()

Returns a string that represents the current object.

Extension Methods

Name Description
RenderText(ChatResponse)

Renders the supplied response to a string. The returned string can used as part of constructing an evaluation prompt to evaluate a conversation that includes the supplied response.

AsOpenAIChatCompletion(ChatResponse)

Creates an OpenAI ChatCompletion from a ChatResponse.

AsOpenAIResponse(ChatResponse, ChatOptions)

Creates an OpenAI OpenAIResponse from a ChatResponse.

Applies to