Table of Contents

Class MessageExtension

Namespace
AutoGen.Core
Assembly
AutoGen.Core.dll
public static class MessageExtension
Inheritance
MessageExtension
Inherited Members

Methods

FormatMessage(AggregateMessage<ToolCallMessage, ToolCallResultMessage>)

public static string FormatMessage(this AggregateMessage<ToolCallMessage, ToolCallResultMessage> message)

Parameters

message AggregateMessage<ToolCallMessage, ToolCallResultMessage>

Returns

string

FormatMessage(IMessage)

public static string FormatMessage(this IMessage message)

Parameters

message IMessage

Returns

string

FormatMessage(ImageMessage)

public static string FormatMessage(this ImageMessage message)

Parameters

message ImageMessage

Returns

string

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

string

FormatMessage(TextMessage)

public static string FormatMessage(this TextMessage message)

Parameters

message TextMessage

Returns

string

FormatMessage(ToolCallMessage)

public static string FormatMessage(this ToolCallMessage message)

Parameters

message ToolCallMessage

Returns

string

FormatMessage(ToolCallResultMessage)

public static string FormatMessage(this ToolCallResultMessage message)

Parameters

message ToolCallResultMessage

Returns

string

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

string

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

IList<ToolCall>

IsSystemMessage(IMessage)

public static bool IsSystemMessage(this IMessage message)

Parameters

message IMessage

Returns

bool