語言

ChatResponseExtensions.RenderText(ChatResponse) 方法

定義

將所提供的 response 轉譯為 string。 回覆 string 可作為構建評估提示的一部分,以評估包含所提供 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

參數

response
ChatResponse

ChatResponse那個要被渲染的部分。

傳回

string包含渲染的 response。

備註

此函數僅考慮 ,Text忽略AIContent任何非 ContentsMessagesTextContents 的 s。 任何 Messages 不含 TextContents 的都會被跳過且不會被渲染。 如果沒有任何 包含 Messages 任何 TextContents,這個函式會回傳一個空字串。

渲染的 Messages 每組在回傳字串中都會加上 Role 和 AuthorName (如果有的話)。 渲染後 Messages的 s 也會在回傳字串中以新行字元分隔。

適用於