Skip to content

Commit

Permalink
add test file
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-sky committed Nov 1, 2023
1 parent 257df15 commit f09dd59
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/test_gui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from autogen.gradio_gui import init_config
from autogen.gradio_gui.utils.general import AutoGenGroupChat
from autogen.gradio_gui.plugin import autogen_terminal
from autogen.gradio_gui.gradio_service import main
import os
llm_config = init_config()

# <------------------- define autogen agents (group chat) ------------------->
class AutoGenGroupChat(AutoGenGroupChat):
def define_agents(self):
from autogen import AssistantAgent, UserProxyAgent
agents = [
{
"name": "Engineer", # name of the agent.
"cls": AssistantAgent, # class of the agent.
"llm_config": llm_config,
"system_message": '''Engineer. You follow an approved plan. You write python/shell code to solve tasks. Wrap the code in a code block that specifies the script type. The user can't modify your code. So do not suggest incomplete code which requires others to modify. Don't use a code block if it's not intended to be executed by the executor. Don't include multiple code blocks in one response. Do not ask others to copy and paste the result. Check the execution result returned by the executor. If the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can't be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.'''
},
{
"name": "user_proxy", # name of the agent.
"cls": UserProxyAgent, # class of the agent.
"human_input_mode": "NEVER", # never ask for human input.
# disables llm-based auto reply.
"llm_config": False,
"code_execution_config": False,
"system_message": "A human admin. Interact with the planner to discuss the plan. Plan execution needs to be approved by this admin.",
},
]
return agents

def define_group_chat_manager_config(self):
llm_config.update({"temperature": 0})
return {"llm_config": llm_config}

def autogen_terminal_groupchat(*args, **kwargs):
return autogen_terminal(*args, AutoGenFn=AutoGenGroupChat, Callback=f"{os.path.basename(__file__).split('.py')[0]}->autogen_terminal_fn_02", **kwargs)

if __name__ == "__main__":
main(
{
"AutoGen sci group chat": {
"Group": "Agent",
"Color": "stop",
"AsButton": True,
"AdvancedArgs": False,
"Function": autogen_terminal_groupchat
},
}
)

0 comments on commit f09dd59

Please sign in to comment.