Share via


ChatResponseExtensions.RenderText(ChatResponse) Method

Definition

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.

public:
[System::Runtime::CompilerServices::Extension]
 static System::String ^ RenderText(Microsoft::Extensions::AI::ChatResponse ^ response);
public static string RenderText(this Microsoft.Extensions.AI.ChatResponse response);
static member RenderText : Microsoft.Extensions.AI.ChatResponse -> string
<Extension()>
Public Function RenderText (response As ChatResponse) As String

Parameters

response
ChatResponse

The ChatResponse that is to be rendered.

Returns

A string containing the rendered response.

Remarks

This function only considers the Text and ignores any AIContents (present within the Contents of the Messages) that are not TextContents. Any Messages that contain no TextContents will be skipped and will not be rendered. If none of the Messages include any TextContents then this function will return an empty string.

The rendered Messages are each prefixed with the Role and AuthorName (if available) in the returned string. The rendered Messagess are also always separated by new line characters in the returned string.

Applies to