Class AgentExtension
public static class AgentExtension
- Inheritance
-
AgentExtension
- Inherited Members
Methods
InitiateChatAsync(IAgent, IAgent, string?, int, CancellationToken)
Shortcut API to send message to another agent and get all responses. To iterate over the responses, use SendAsync(IAgent, IAgent, string, IEnumerable<IMessage>?, int, CancellationToken) or SendAsync(IAgent, IAgent, IEnumerable<IMessage>, int, CancellationToken)
public static Task<IEnumerable<IMessage>> InitiateChatAsync(this IAgent agent, IAgent receiver, string? message = null, int maxRound = 10, CancellationToken ct = default)
Parameters
agentIAgentsender agent
receiverIAgentreceiver agent
messagestringmessage to send
maxRoundintmax round
ctCancellationToken
Returns
SendAsync(IAgent, IAgent, IEnumerable<IMessage>, int, CancellationToken)
Send message to another agent and iterate over the responses.
public static IAsyncEnumerable<IMessage> SendAsync(this IAgent agent, IAgent receiver, IEnumerable<IMessage> chatHistory, int maxRound = 10, CancellationToken ct = default)
Parameters
agentIAgentsender agent.
receiverIAgentreceiver agent.
chatHistoryIEnumerable<IMessage>chat history.
maxRoundintmax conversation round.
ctCancellationToken
Returns
- IAsyncEnumerable<IMessage>
conversation history
SendAsync(IAgent, IAgent, string, IEnumerable<IMessage>?, int, CancellationToken)
Send message to another agent and iterate over the responses.
public static IAsyncEnumerable<IMessage> SendAsync(this IAgent agent, IAgent receiver, string message, IEnumerable<IMessage>? chatHistory = null, int maxRound = 10, CancellationToken ct = default)
Parameters
agentIAgentsender agent.
receiverIAgentreceiver agent.
messagestringmessage to send. will be added to the end of
chatHistoryif providedchatHistoryIEnumerable<IMessage>chat history.
maxRoundintmax conversation round.
ctCancellationToken
Returns
- IAsyncEnumerable<IMessage>
conversation history
SendAsync(IAgent, IMessage?, IEnumerable<IMessage>?, CancellationToken)
Send message to an agent.
public static Task<IMessage> SendAsync(this IAgent agent, IMessage? message = null, IEnumerable<IMessage>? chatHistory = null, CancellationToken ct = default)
Parameters
agentIAgentsender agent.
messageIMessagemessage to send. will be added to the end of
chatHistoryif providedchatHistoryIEnumerable<IMessage>chat history.
ctCancellationToken
Returns
SendAsync(IAgent, string, IEnumerable<IMessage>?, CancellationToken)
Send message to an agent.
public static Task<IMessage> SendAsync(this IAgent agent, string message, IEnumerable<IMessage>? chatHistory = null, CancellationToken ct = default)
Parameters
agentIAgentsender agent.
messagestringmessage to send. will be added to the end of
chatHistoryif providedchatHistoryIEnumerable<IMessage>chat history.
ctCancellationToken
Returns
SendMessageToGroupAsync(IAgent, IGroupChat, IEnumerable<IMessage>?, int, CancellationToken)
[Obsolete("use GroupChatExtension.SendAsync")]
public static IAsyncEnumerable<IMessage> SendMessageToGroupAsync(this IAgent _, IGroupChat groupChat, IEnumerable<IMessage>? chatHistory = null, int maxRound = 10, CancellationToken ct = default)
Parameters
_IAgentgroupChatIGroupChatchatHistoryIEnumerable<IMessage>maxRoundintctCancellationToken
Returns
SendMessageToGroupAsync(IAgent, IGroupChat, string, IEnumerable<IMessage>?, int, CancellationToken)
[Obsolete("use GroupChatExtension.SendAsync")]
public static IAsyncEnumerable<IMessage> SendMessageToGroupAsync(this IAgent agent, IGroupChat groupChat, string msg, IEnumerable<IMessage>? chatHistory = null, int maxRound = 10, CancellationToken ct = default)
Parameters
agentIAgentgroupChatIGroupChatmsgstringchatHistoryIEnumerable<IMessage>maxRoundintctCancellationToken