Class MessageExtension
public static class MessageExtension
- Inheritance
-
MessageExtension
- Inherited Members
Methods
FormatMessage(AggregateMessage<ToolCallMessage, ToolCallResultMessage>)
public static string FormatMessage(this AggregateMessage<ToolCallMessage, ToolCallResultMessage> message)
Parameters
Returns
FormatMessage(IMessage)
public static string FormatMessage(this IMessage message)
Parameters
message
IMessage
Returns
FormatMessage(ImageMessage)
public static string FormatMessage(this ImageMessage message)
Parameters
message
ImageMessage
Returns
FormatMessage(Message)
[Obsolete("This method is deprecated, please use the extension method FormatMessage(this IMessage message) instead.")]
public static string FormatMessage(this Message message)
Parameters
message
Message
Returns
FormatMessage(TextMessage)
public static string FormatMessage(this TextMessage message)
Parameters
message
TextMessage
Returns
FormatMessage(ToolCallMessage)
public static string FormatMessage(this ToolCallMessage message)
Parameters
message
ToolCallMessage
Returns
FormatMessage(ToolCallResultMessage)
public static string FormatMessage(this ToolCallResultMessage message)
Parameters
message
ToolCallResultMessage
Returns
GetContent(IMessage)
Get the content from the message
if the message implements ICanGetTextContent, return the content from the message by calling GetContent()
if the message is a AggregateMessage<TMessage1, TMessage2> where TMessage1 is ToolCallMessage and TMessage2 is ToolCallResultMessage and the second message only contains one function call, return the result of that function call
for all other situation, return null.
public static string? GetContent(this IMessage message)
Parameters
message
IMessage
Returns
GetRole(IMessage)
Get the role from the message if it's available.
public static Role? GetRole(this IMessage message)
Parameters
message
IMessage
Returns
- Role?
GetToolCalls(IMessage)
Return the tool calls from the message if it's available.
if the message implements ICanGetToolCalls, return the tool calls from the message by calling GetToolCalls()
if the message is a AggregateMessage<TMessage1, TMessage2> where TMessage1 is ToolCallMessage and TMessage2 is ToolCallResultMessage, return the tool calls from the first message
public static IList<ToolCall>? GetToolCalls(this IMessage message)
Parameters
message
IMessage
Returns
IsSystemMessage(IMessage)
public static bool IsSystemMessage(this IMessage message)
Parameters
message
IMessage