diff --git a/.gitignore b/.gitignore index 47917823422c..3172f6239957 100644 --- a/.gitignore +++ b/.gitignore @@ -167,3 +167,7 @@ wolfram.txt # DB on disk for TeachableAgent tmp/ + +# logs +gpt_log +debug_gui.py \ No newline at end of file diff --git a/autogen/gradio_gui/README.md b/autogen/gradio_gui/README.md index b5cb94cf754f..c5f107a69f39 100644 --- a/autogen/gradio_gui/README.md +++ b/autogen/gradio_gui/README.md @@ -10,17 +10,15 @@ First install AutoGen: python -m pip install pyautogen ``` -Next, run following command launch GUI: +Next, run following commands launch GUI: ```bash -export API_KEY= -export API_KEY= +export OAI_CONFIG_LIST='/path/to/OAI_CONFIG_LIST' python -m autogen.launch_gui ``` > Note: > When you run `launch_gui`, the program will automatically install additional dependencies with `pip install --user ...` -> ## Customize your own multiagent chat @@ -30,138 +28,6 @@ python -m autogen.launch_gui - Then run it ```python -# <------------------- import -------------------> -from autogen.gradio_gui.gradio_service import main, install_dependencies -from autogen.gradio_gui.plugin import autogen_terminal -from autogen.gradio_gui.utils.general import AutoGenGeneral, AutoGenGroupChat -from void_terminal.toolbox import CatchException - -# <------------------- define autogen agents (assistant + user_proxy) -------------------> -class AutoGenAskHuman(AutoGenGeneral): - def define_agents(self): - from autogen import AssistantAgent, UserProxyAgent - return [ - { - "name": "assistant", # name of the agent. - "cls": AssistantAgent, # class of the agent. - }, - { - "name": "user_proxy", # name of the agent. - "cls": UserProxyAgent, # class of the agent. - "human_input_mode": "ALWAYS", # always ask for human input. - "llm_config": False, # disables llm-based auto reply. - }, - ] - - -# <------------------- define autogen agents (group chat) -------------------> -class AutoGenGroupChat(AutoGenGroupChat): - def define_agents(self): - from autogen import AssistantAgent, UserProxyAgent - return [ - { - "name": "Engineer", # name of the agent. - "cls": AssistantAgent, # class of the agent. - "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": "Scientist", # name of the agent. - "cls": AssistantAgent, # class of the agent. - "system_message": '''Scientist. You follow an approved plan. You are able to categorize papers after seeing their abstracts printed. You don't write code.''' - }, - { - "name": "Planner", # name of the agent. - "cls": AssistantAgent, # class of the agent. - "system_message": '''Planner. Suggest a plan. Revise the plan based on feedback from admin and critic, until admin approval. The plan may involve an engineer who can write code and a scientist who doesn't write code. Explain the plan first. Be clear which step is performed by an engineer, and which step is performed by a scientist.''' - }, - { - "name": "Executor", # name of the agent. - "cls": UserProxyAgent, # class of the agent. - "human_input_mode": "NEVER", - "system_message": '''Executor. Execute the code written by the engineer and report the result.''' - }, - { - "name": "Critic", # name of the agent. - "cls": AssistantAgent, # class of the agent. - "system_message": '''Critic. Double check plan, claims, code from other agents and provide feedback. Check whether the plan includes adding verifiable info such as source URL.''' - }, - { - "name": "user_proxy", # name of the agent. - "cls": UserProxyAgent, # class of the agent. - "human_input_mode": "NEVER", # never ask for human input. - "llm_config": False, # disables llm-based auto reply. - "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.", - }, - ] - - - - -# <------------------- define autogen buttons -------------------> -@CatchException -def autogen_terminal_fn_01(*args, **kwargs): - return autogen_terminal(*args, AutoGenFn=AutoGenAskHuman, Callback="launch_gui->autogen_terminal_fn_01", **kwargs) - -@CatchException -def autogen_terminal_fn_02(*args, **kwargs): - return autogen_terminal(*args, AutoGenFn=AutoGenGroupChat, Callback="launch_gui->autogen_terminal_fn_02", **kwargs) - - -if __name__ == "__main__": - # <------------------- change configurations -------------------> - import void_terminal - - # void_terminal.set_conf(key="USE_PROXY", value=True) - # void_terminal.set_conf(key="proxies", value='{"http": "http://localhost:10881", "https": "http://localhost:10881"}') - void_terminal.set_conf(key="API_KEY",value="sk-yourapikey") - void_terminal.set_conf(key="LLM_MODEL", value="gpt-3.5-turbo-16k") - void_terminal.set_conf(key="AUTOGEN_USE_DOCKER", value=False) - void_terminal.set_conf(key="PATH_LOGGING", value="gpt_log") - void_terminal.set_conf(key="DARK_MODE", value=True) - void_terminal.set_conf(key="AUTO_CLEAR_TXT", value=True) - - - # <------------------- add fn buttons to GUI & launch gradio -------------------> - from void_terminal.crazy_functions.ConversationHistoryArchive import ConversationHistoryArchive - from void_terminal.crazy_functions.Accessibility import ClearCache - main( - { - # <------------------- autogen functions we defined above -------------------> - "AutoGen assitant": { - "Group": "Agent", - "Color": "stop", - "AsButton": True, - "AdvancedArgs": False, - "Function": autogen_terminal_fn_01 - }, - "AutoGen sci group chat": { - "Group": "Agent", - "Color": "stop", - "AsButton": True, - "AdvancedArgs": False, - "Function": autogen_terminal_fn_02 - }, - - # <------------------- other functions from void terminal -------------------> - "Save the current conversation": { - "Group": "Conversation", - "Color": "stop", - "AsButton": True, - "Info": "Save current conversation | No input parameters required", - "AdvancedArgs": False, - "Function": ConversationHistoryArchive - }, - "Clear all cache files": { - "Group": "Conversation", - "Color": "stop", - "AsButton": True, - "Info": "Clear all cache files,Handle with caution | No input parameters required", - "AdvancedArgs": False, - "Function": ClearCache - }, - } - ) ``` diff --git a/autogen/gradio_gui/__init__.py b/autogen/gradio_gui/__init__.py index e69de29bb2d1..0384320b43a1 100644 --- a/autogen/gradio_gui/__init__.py +++ b/autogen/gradio_gui/__init__.py @@ -0,0 +1,78 @@ +def install_dependencies(): + # <------------------- install dependencies -------------------> + def try_install_deps(deps, reload_m=[]): + """ + install dependencies if not installed. + """ + input(f'You are about to install dependencies {str(deps)}, press Enter to continue ...') + import subprocess, sys, importlib + for dep in deps: + subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', dep]) + import site + importlib.reload(site) + for m in reload_m: + importlib.reload(__import__(m)) + + # <------------------- dependencies -------------------> + try: + import gradio as gr + import void_terminal + except: + try_install_deps(deps=["void-terminal>=0.0.9"]) + try_install_deps(deps=["https://github.com/binary-husky/gpt_academic/raw/master/docs/gradio-3.32.6-py3-none-any.whl"]) + + if gr.__version__ not in ['3.32.6']: + # this is a special version of gradio, which is not available on pypi.org + try_install_deps(deps=["https://github.com/binary-husky/gpt_academic/raw/master/docs/gradio-3.32.6-py3-none-any.whl"]) + +def init_config_list(): + import os + from autogen import config_list_from_json + config_file_path = os.environ.get("OAI_CONFIG_LIST") + if config_file_path is None: + raise EnvironmentError(""" +OAI_CONFIG_LIST path is not set. +Please run with + `export OAI_CONFIG_LIST='/path/to/OAI_CONFIG_LIST'` +to set the path to config list file, and then run + `python -m autogen.launch_gui` +to start the GUI. +""") + config_list = config_list_from_json(env_or_file=config_file_path) + llm_config = {"config_list": config_list} + return llm_config + + +def init_config(): + import void_terminal + + llm_config = init_config_list() + # set network proxy + # void_terminal.set_conf(key="USE_PROXY", value=True) + # void_terminal.set_conf(key="proxies", value='{"http": "http://localhost:10881", "https": "http://localhost:10881"}') + void_terminal.set_conf(key="AUTOGEN_USE_DOCKER", value=False) + void_terminal.set_conf(key="PATH_LOGGING", value="gpt_log") + void_terminal.set_conf(key="DARK_MODE", value=True) + void_terminal.set_conf(key="AUTO_CLEAR_TXT", value=True) + + # the following configurations only influence direct chat, not autogen + void_terminal.set_conf(key="API_KEY", value=llm_config["config_list"][0]["api_key"]) + void_terminal.set_conf(key="LLM_MODEL", value=llm_config["config_list"][0]["model"]) + # void_terminal.set_conf(key="API_KEY",value="sk-yourapikey") + # void_terminal.set_conf(key="LLM_MODEL", value="gpt-3.5-turbo-16k") + if llm_config["config_list"][0].get('api_type', '') == 'azure': + model = 'azure-'+llm_config["config_list"][0]["model"] + api_base = llm_config["config_list"][0]["api_base"] + if api_base.endswith('/'): api_base = api_base[:-1] + AZURE_CFG_ARRAY = { + model: + { + "AZURE_ENDPOINT": llm_config["config_list"][0]["api_base"] + '/', + "AZURE_API_KEY": llm_config["config_list"][0]["api_key"], + "AZURE_ENGINE": llm_config["config_list"][0]["deployment_id"], + "AZURE_MODEL_MAX_TOKEN": 8192, + }, + } + void_terminal.set_conf(key="LLM_MODEL", value=model) + void_terminal.set_conf(key="AZURE_CFG_ARRAY", value=str(AZURE_CFG_ARRAY)) + return llm_config \ No newline at end of file diff --git a/autogen/gradio_gui/gradio_service.py b/autogen/gradio_gui/gradio_service.py index 68d70807c46d..cca9a1b82b85 100644 --- a/autogen/gradio_gui/gradio_service.py +++ b/autogen/gradio_gui/gradio_service.py @@ -10,7 +10,7 @@ def main(plugins): raise ModuleNotFoundError( "Use the built-in Gradio for the best experience!" + "Please run `pip install -r https://github.com/binary-husky/gpt_academic/raw/master/docs/gradio-3.32.6-py3-none-any.whl` Command to install built-in Gradio and other dependencies, See details in requirements.txt.") - from void_terminal.request_llm.bridge_all import predict + from void_terminal.request_llms.bridge_all import predict from void_terminal.toolbox import format_io, find_free_port, on_file_uploaded, on_report_generated, get_conf, ArgsGeneralWrapper, load_chat_cookies, DummyWith proxies, WEB_PORT, LLM_MODEL, CONCURRENT_COUNT, AUTHENTICATION = get_conf('proxies', 'WEB_PORT', 'LLM_MODEL', 'CONCURRENT_COUNT', 'AUTHENTICATION') CHATBOT_HEIGHT, LAYOUT, AVAIL_LLM_MODELS, AUTO_CLEAR_TXT = get_conf('CHATBOT_HEIGHT', 'LAYOUT', 'AVAIL_LLM_MODELS', 'AUTO_CLEAR_TXT') @@ -49,7 +49,7 @@ def main(plugins): # from void_terminal.crazy_functional import get_crazy_functions # plugins = get_crazy_functions() # for k, v in plugins.items(): plugins[k]['Group'] = "Agent" - # DEFAULT_FN_GROUPS, = get_conf('DEFAULT_FN_GROUPS') + # DEFAULT_FN_GROUPS = get_conf('DEFAULT_FN_GROUPS') DEFAULT_FN_GROUPS = ["Agent", "Conversation"] all_plugin_groups = list(set([g for _, plugin in plugins.items() for g in plugin['Group'].split('|')])) match_group = lambda tags, groups: any([g in groups for g in tags.split('|')]) @@ -312,6 +312,8 @@ def fn_area_visibility_2(a): if not plugins[k].get("AsButton", True): continue click_handle = plugins[k]["Button"].click(ArgsGeneralWrapper(plugins[k]["Function"]), [*input_combo], output_combo) click_handle.then(on_report_generated, [cookies, file_upload, chatbot], [cookies, file_upload, chatbot]) + if AUTO_CLEAR_TXT: + plugins[k]["Button"].click(lambda: ("",""), None, [txt, txt2]) cancel_handles.append(click_handle) # Interaction between dropdown menu and dynamic button in function plugin def on_dropdown_changed(k): @@ -393,7 +395,7 @@ def init_cookie(cookies, chatbot): "- plot $y=x^2$ with $x \in (-2,1)$, save the image to res.jpg\n\n" + "- find the solution of $sin(x)=cos(x)$ by ploting the culve within $x > 0$, save the image to res.png\n\n" + "- plot $z=cos(x^2+y^2)$, save the image to wave.jpg\n\n" + - "(2) click the small red button `AutoGen_Fn_01`."]) + "(2) click the small red button `AutoGen ...`."]) return cookies, chatbot demo.load(init_cookie, inputs=[cookies, chatbot], outputs=[cookies, chatbot]) darkmode_js = """(dark) => { diff --git a/autogen/gradio_gui/plugin.py b/autogen/gradio_gui/plugin.py index ad5eaaf69b2b..bc0f32ad88c5 100644 --- a/autogen/gradio_gui/plugin.py +++ b/autogen/gradio_gui/plugin.py @@ -29,7 +29,7 @@ def autogen_terminal(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_pr web_port Port number on which the software is running """ # Check if the current model meets the requirements - supported_llms = ['gpt-3.5-turbo-16k', 'gpt-4', 'gpt-4-32k'] + supported_llms = ['gpt-3.5-turbo-16k', 'gpt-4', 'gpt-4-32k', 'azure-gpt-3.5-turbo-16k', 'azure-gpt-4', 'azure-gpt-4-32k'] llm_kwargs['api_key'] = select_api_key( llm_kwargs['api_key'], llm_kwargs['llm_model']) if llm_kwargs['llm_model'] not in supported_llms: @@ -39,7 +39,7 @@ def autogen_terminal(txt, llm_kwargs, plugin_kwargs, chatbot, history, system_pr return # Check if the current model meets the requirements - API_URL_REDIRECT, = get_conf('API_URL_REDIRECT') + API_URL_REDIRECT = get_conf('API_URL_REDIRECT') if len(API_URL_REDIRECT) > 0: chatbot.append([f"Task: {txt}", f"Transfers are not supported."]) yield from update_ui(chatbot=chatbot, history=history) diff --git a/autogen/gradio_gui/utils/general.py b/autogen/gradio_gui/utils/general.py index 8dc3f8706859..3f1ad2931ac9 100644 --- a/autogen/gradio_gui/utils/general.py +++ b/autogen/gradio_gui/utils/general.py @@ -35,11 +35,6 @@ def do_audogen(self, input): # ⭐⭐ run in subprocess input = input.content with ProxyNetworkActivate("AutoGen"): - from autogen import AssistantAgent, UserProxyAgent - config_list = [{ - 'model': self.llm_kwargs['llm_model'], - 'api_key': self.llm_kwargs['api_key'], - },] code_execution_config={"work_dir": self.autogen_work_dir, "use_docker":self.use_docker} agents = self.define_agents() user_proxy = None @@ -47,9 +42,6 @@ def do_audogen(self, input): for agent_kwargs in agents: agent_cls = agent_kwargs.pop('cls') kwargs = { - 'llm_config':{ - "config_list": config_list, - }, 'code_execution_config':code_execution_config } kwargs.update(agent_kwargs) @@ -81,39 +73,34 @@ def do_audogen(self, input): # ⭐⭐ run in subprocess import autogen from void_terminal.toolbox import trimmed_format_exc, ProxyNetworkActivate - from autogen.gradio_gui.utils.pipe import PluginMultiprocessManager, PipeCom + from autogen.gradio_gui.utils.pipe import PipeCom input = input.content with ProxyNetworkActivate("AutoGen"): - config_list = [{ - 'model': self.llm_kwargs['llm_model'], - 'api_key': self.llm_kwargs['api_key'], - },] code_execution_config={"work_dir": self.autogen_work_dir, "use_docker":self.use_docker} agents = self.define_agents() - agents = [] + agents_instances = [] for agent_kwargs in agents: agent_cls = agent_kwargs.pop('cls') kwargs = { - 'llm_config':{ - "config_list": config_list, - }, 'code_execution_config':code_execution_config } kwargs.update(agent_kwargs) agent_handle = agent_cls(**kwargs) agent_handle._print_received_message = lambda a,b: self.gpt_academic_print_override(agent_kwargs, a, b) - agents.append(agent_handle) + agents_instances.append(agent_handle) if agent_kwargs['name'] == 'user_proxy': - agent_handle.get_human_input = lambda a: self.gpt_academic_get_human_input(user_proxy, a) user_proxy = agent_handle + user_proxy.get_human_input = lambda a: self.gpt_academic_get_human_input(user_proxy, a) try: - groupchat = autogen.GroupChat(agents=agents, messages=[], max_round=50) - manager = autogen.GroupChatManager(groupchat=groupchat, llm_config={ - "temperature": 0, - "config_list": config_list, - }) + groupchat = autogen.GroupChat(agents=agents_instances, messages=[], max_round=50) + manager = autogen.GroupChatManager(groupchat=groupchat, **self.define_group_chat_manager_config()) + manager._print_received_message = lambda a,b: self.gpt_academic_print_override(agent_kwargs, a, b) + manager.get_human_input = lambda a: self.gpt_academic_get_human_input(manager, a) if user_proxy is None: raise Exception("user_proxy is not defined") user_proxy.initiate_chat(manager, message=input) except Exception as e: tb_str = '```\n' + trimmed_format_exc() + '```' self.child_conn.send(PipeCom("done", "AutoGen exe failed: \n\n" + tb_str)) + + def define_group_chat_manager_config(self): + raise NotImplementedError \ No newline at end of file diff --git a/autogen/gradio_gui/utils/pipe.py b/autogen/gradio_gui/utils/pipe.py index 52a61d985baa..cd8bd01a271e 100644 --- a/autogen/gradio_gui/utils/pipe.py +++ b/autogen/gradio_gui/utils/pipe.py @@ -13,14 +13,13 @@ def __init__(self, llm_kwargs, plugin_kwargs, chatbot, history, system_prompt, w # ⭐ run in main process self.autogen_work_dir = os.path.join(get_log_folder('autogen'), gen_time_str()) self.previous_work_dir_files = {} - self.llm_kwargs = llm_kwargs self.plugin_kwargs = plugin_kwargs self.chatbot = chatbot self.history = history self.system_prompt = system_prompt self.web_port = web_port self.alive = True - self.use_docker, = get_conf('AUTOGEN_USE_DOCKER') + self.use_docker = get_conf('AUTOGEN_USE_DOCKER') # create a thread to monitor self.heartbeat, terminate the instance if no heartbeat for a long time timeout_seconds = 5*60 @@ -100,6 +99,9 @@ def main_process_ui_control(self, txt, create_or_resume) -> str: if create_or_resume == 'create': self.cnt = 1 self.parent_conn = self.launch_subprocess_with_pipe() # ⭐⭐⭐ + else: + if 'Waiting for further instructions.' in self.chatbot[-1][-1]: + self.chatbot.pop(-1) # remove the last line self.send_command(txt) if txt == 'exit': @@ -113,6 +115,8 @@ def main_process_ui_control(self, txt, create_or_resume) -> str: if self.parent_conn.poll(): if '[GPT-Academic] waiting' in self.chatbot[-1][-1]: self.chatbot.pop(-1) # remove the last line + if 'Waiting for further instructions.' in self.chatbot[-1][-1]: + self.chatbot.pop(-1) # remove the last line msg = self.parent_conn.recv() # PipeCom if msg.cmd == "done": self.chatbot.append([f"terminate", msg.content]) diff --git a/autogen/launch_gui.py b/autogen/launch_gui.py index 3da0f354b271..0cabb54cd4b6 100644 --- a/autogen/launch_gui.py +++ b/autogen/launch_gui.py @@ -1,102 +1,88 @@ -def install_dependencies(): - # <------------------- install dependencies -------------------> - def try_install_deps(deps, reload_m=[]): - """ - install dependencies if not installed. - """ - input(f'You are about to install dependencies {str(deps)}, press Enter to continue ...') - import subprocess, sys, importlib - for dep in deps: - subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--user', dep]) - import site - importlib.reload(site) - for m in reload_m: - importlib.reload(__import__(m)) - - # <------------------- dependencies -------------------> - try: - import gradio as gr - import void_terminal - except: - try_install_deps(deps=["void-terminal>=0.0.8"]) - try_install_deps(deps=["https://github.com/binary-husky/gpt_academic/raw/master/docs/gradio-3.32.6-py3-none-any.whl"]) - - if gr.__version__ not in ['3.32.6']: - # this is a special version of gradio, which is not available on pypi.org - try_install_deps(deps=["https://github.com/binary-husky/gpt_academic/raw/master/docs/gradio-3.32.6-py3-none-any.whl"]) - # <------------------- import -------------------> -install_dependencies() - -# <------------------- import -------------------> -from autogen.gradio_gui.gradio_service import main, install_dependencies -from autogen.gradio_gui.plugin import autogen_terminal from autogen.gradio_gui.utils.general import AutoGenGeneral, AutoGenGroupChat -from void_terminal.toolbox import CatchException +from autogen.gradio_gui.plugin import autogen_terminal +from autogen.gradio_gui.gradio_service import main +from autogen.gradio_gui import install_dependencies, init_config + +install_dependencies() +llm_config = init_config() -# <------------------- define autogen agents (assistant + user_proxy) -------------------> class AutoGenAskHuman(AutoGenGeneral): def define_agents(self): from autogen import AssistantAgent, UserProxyAgent - return [ + agents = [ { "name": "assistant", # name of the agent. "cls": AssistantAgent, # class of the agent. + "llm_config": llm_config, }, { "name": "user_proxy", # name of the agent. "cls": UserProxyAgent, # class of the agent. "human_input_mode": "ALWAYS", # always ask for human input. - "llm_config": False, # disables llm-based auto reply. + # disables llm-based auto reply. + "llm_config": False, }, ] + return agents # <------------------- define autogen agents (group chat) -------------------> class AutoGenGroupChat(AutoGenGroupChat): def define_agents(self): from autogen import AssistantAgent, UserProxyAgent - return [ + 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": "Scientist", # name of the agent. "cls": AssistantAgent, # class of the agent. + "llm_config": llm_config, "system_message": '''Scientist. You follow an approved plan. You are able to categorize papers after seeing their abstracts printed. You don't write code.''' }, { "name": "Planner", # name of the agent. "cls": AssistantAgent, # class of the agent. + "llm_config": llm_config, "system_message": '''Planner. Suggest a plan. Revise the plan based on feedback from admin and critic, until admin approval. The plan may involve an engineer who can write code and a scientist who doesn't write code. Explain the plan first. Be clear which step is performed by an engineer, and which step is performed by a scientist.''' }, { "name": "Executor", # name of the agent. "cls": UserProxyAgent, # class of the agent. "human_input_mode": "NEVER", + "llm_config": llm_config, "system_message": '''Executor. Execute the code written by the engineer and report the result.''' }, { "name": "Critic", # name of the agent. "cls": AssistantAgent, # class of the agent. + "llm_config": llm_config, "system_message": '''Critic. Double check plan, claims, code from other agents and provide feedback. Check whether the plan includes adding verifiable info such as source URL.''' }, { "name": "user_proxy", # name of the agent. "cls": UserProxyAgent, # class of the agent. "human_input_mode": "NEVER", # never ask for human input. - "llm_config": False, # disables llm-based auto reply. + # 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} + # <------------------- define autogen buttons -------------------> +from void_terminal.toolbox import CatchException + @CatchException def autogen_terminal_fn_01(*args, **kwargs): return autogen_terminal(*args, AutoGenFn=AutoGenAskHuman, Callback="launch_gui->autogen_terminal_fn_01", **kwargs) @@ -107,17 +93,6 @@ def autogen_terminal_fn_02(*args, **kwargs): if __name__ == "__main__": - # <------------------- change configurations -------------------> - import void_terminal - - # void_terminal.set_conf(key="USE_PROXY", value=True) - # void_terminal.set_conf(key="proxies", value='{"http": "http://localhost:10881", "https": "http://localhost:10881"}') - void_terminal.set_conf(key="API_KEY",value="sk-yourapikey") - void_terminal.set_conf(key="LLM_MODEL", value="gpt-3.5-turbo-16k") - void_terminal.set_conf(key="AUTOGEN_USE_DOCKER", value=False) - void_terminal.set_conf(key="PATH_LOGGING", value="gpt_log") - void_terminal.set_conf(key="DARK_MODE", value=True) - void_terminal.set_conf(key="AUTO_CLEAR_TXT", value=True) # <------------------- add fn buttons to GUI & launch gradio -------------------> diff --git a/setup.py b/setup.py index c68c1062ae43..e034e0b99477 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ "retrievechat": ["chromadb", "tiktoken", "sentence_transformers", "pypdf"], "teachable": ["chromadb"], "gui":[ - "void-terminal>=0.0.8", + "void-terminal>=0.0.9", ] }, classifiers=[