-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[.Net][Issue]: How to communicate with multi-agent through API #2622
Comments
Yes, The code for Also, can you put a title in the issue, thanks! |
This is not what I want. After testing the console, I hope to develop an API to interact with the user UI. https://github.com/xuzeyu91/EasyAgent/blob/main/src/EasyAgent/Pages/Chat/Chat.razor.cs This is my code. I am currently waiting in the RegisterMiddleware of the UserProxyAgent until the user enters text before continuing. This is not very good, and I hope there is a better way to handle it |
@xuzeyu91 Thanks for your reply. In your My suggestion here though is to update your Here is the pesude code. // in OnSendAsync function
ChatMessage[] chatHistory;
GroupChat groupChat;
// in userProxyAgent, set input mode to never and a default reply message so it always return "wait for user input" when it's selected.
IAgent userProxyAgent = new UserProxyAgent(humanInputMode: HumanInputMode.NEVER, defaultReply: "wait for user input")
string userInputContent; // suppose this is the latest user message
while (true)
{
// add latest user input to chatHistory
chatHistory.Add(userInputContent);
// continue group chat
// set maxTurn to 1 so it stop after one round
var newMessages = await groupChat.SendAsync(chatHistory: chatHistory, maxTurn: 1);
// check if the newMessages[0] comes from user
if (newMessages[0].From == "user")
{
// exit to wait for user input
return;
}
else
{
// carry on the conversation by add new messages to history and continue
chatHistory.AddRange(newMessages);
}
} |
thank you |
Describe the issue
Viewing demos using console output
How should I obtain messages from multiple agents when using GroupAgent?
Is there an example, as well as the input to the console? If I want to use the interface for interaction, how can I implement it
Steps to reproduce
Does RegisterPrintMessage have methods such as events to retrieve messages
Screenshots and logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: