Closed rakshitha-yalamanchili-5 closed 6 days ago
Hi, this is because in AutoGen.Net, the human input is processed after function call.
To keep the same behavior with AutoGen, we can update the ConversableAgent
by
HumanInputMiddleware
and ToolCallMiddleware
in https://github.com/microsoft/autogen/blob/0cdbc345c56aa0708eb4a15ee70d87b17b5dc0d4/dotnet/src/AutoGen/Agent/ConversableAgent.cs#L172HumanINputMiddleware
, return a ToolCallResult
when the most recent message is ToolCallMessage
close due to won't fix
Describe the issue
I have noticed a difference in Autogen's behavior in python vs dotnet.
A chat between agents in python always asks user feedback for user proxy agent where user can choose to continue or provide feedback
Chat in dotnet does not ask for user input despite user input mode is set to always when tool execution is involved. Assistantagent returns tool function call and userproxyagent executes the tool without asking for user input. Why is this behavior different?
Steps to reproduce
python sample assistant = AssistantAgent( "assistant", llm_config={"config_list": [{"model": "", "api_key": "", "api_type":"", "base_url":"", "api_version":""}]}, system_message= "You are a useful AI assistant. For coding tasks, only use the functions you have been provided with. Return TERMINATE when your task is done" ) user_proxy = UserProxyAgent( "userproxyagent1", is_termination_msg=lambda msg: msg.get("content") is not None and "TERMINATE" in msg["content"], code_execution_config={"executor": executor} ) register_function( calculator, caller=assistant,
executor=user_proxy, name="calculator",
description="A simple calculator",
) This chat between above agents always asks user feedback for user proxy agent where user can choose to continue or provide feedback
Following is code in dotnet:
var agent = new AssistantAgent( name: "assistant", systemMessage: "You are a useful AI assistant. For coding tasks, only use the functions you have been provided with. Return TERMINATE when your task is done", llmConfig: new ConversableAgentConfig { Temperature = 0, ConfigList = new[] { gpt35Config, }, FunctionContracts = [tools.CalculatorFunctionContract] } ).RegisterPrintMessage();
var userProxyAgent = new UserProxyAgent( name: "user", humanInputMode: HumanInputMode.ALWAYS, functionMap: new Dictionary<string, Func<string, Task>>
{
{ tools.CalculatorFunctionContract.Name, tools.CalculatorWrapper },
}
).RegisterPrintMessage();
The above code, does not ask for user input despite user input mode is set to always when tool execution is involved. Assistantagent returns tool function call and userproxyagent executes the tool without asking for user input. Why is this behavior different?
Screenshots and logs
No response
Additional Information
No response