ChatMessageExtensions.RenderText Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| RenderText(ChatMessage) |
Renders the supplied |
| RenderText(IEnumerable<ChatMessage>) |
Renders the supplied |
RenderText(ChatMessage)
- Source:
- ChatMessageExtensions.cs
Renders the supplied message to a string. The returned
string can used as part of constructing an evaluation prompt to evaluate a conversation
that includes the supplied message.
public:
[System::Runtime::CompilerServices::Extension]
static System::String ^ RenderText(Microsoft::Extensions::AI::ChatMessage ^ message);
public static string RenderText(this Microsoft.Extensions.AI.ChatMessage message);
static member RenderText : Microsoft.Extensions.AI.ChatMessage -> string
<Extension()>
Public Function RenderText (message As ChatMessage) As String
Parameters
- message
- ChatMessage
The ChatMessage that is to be rendered.
Returns
A string containing the rendered message.
Remarks
This function only considers the Text and ignores any AIContents (present within the Contents of the message) that are not TextContents. If the message does not contain any TextContents then this function returns an empty string.
The returned string is prefixed with the Role and AuthorName (if available). The returned string also always has a new line character at the end.
Applies to
RenderText(IEnumerable<ChatMessage>)
- Source:
- ChatMessageExtensions.cs
Renders the supplied messages to a string.The returned
string can used as part of constructing an evaluation prompt to evaluate a conversation
that includes the supplied messages.
public:
[System::Runtime::CompilerServices::Extension]
static System::String ^ RenderText(System::Collections::Generic::IEnumerable<Microsoft::Extensions::AI::ChatMessage ^> ^ messages);
public static string RenderText(this System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages);
static member RenderText : seq<Microsoft.Extensions.AI.ChatMessage> -> string
<Extension()>
Public Function RenderText (messages As IEnumerable(Of ChatMessage)) As String
Parameters
- messages
- IEnumerable<ChatMessage>
The ChatMessages that are to be rendered.
Returns
A string containing the rendered messages.
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 ChatMessages are also always separated by new line characters in the returned string.