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
agent
IAgentsender agent
receiver
IAgentreceiver agent
message
stringmessage to send
maxRound
intmax round
ct
CancellationToken
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
agent
IAgentsender agent.
receiver
IAgentreceiver agent.
chatHistory
IEnumerable<IMessage>chat history.
maxRound
intmax conversation round.
ct
CancellationToken
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
agent
IAgentsender agent.
receiver
IAgentreceiver agent.
message
stringmessage to send. will be added to the end of
chatHistory
if providedchatHistory
IEnumerable<IMessage>chat history.
maxRound
intmax conversation round.
ct
CancellationToken
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
agent
IAgentsender agent.
message
IMessagemessage to send. will be added to the end of
chatHistory
if providedchatHistory
IEnumerable<IMessage>chat history.
ct
CancellationToken
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
agent
IAgentsender agent.
message
stringmessage to send. will be added to the end of
chatHistory
if providedchatHistory
IEnumerable<IMessage>chat history.
ct
CancellationToken
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
_
IAgentgroupChat
IGroupChatchatHistory
IEnumerable<IMessage>maxRound
intct
CancellationToken
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
agent
IAgentgroupChat
IGroupChatmsg
stringchatHistory
IEnumerable<IMessage>maxRound
intct
CancellationToken