autogen/test/agentchat/contrib/test_agent_builder.py

210 lines
6.2 KiB
Python
Raw Normal View History

#!/usr/bin/env python3 -m pytest
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
import json
import os
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
import sys
import pytest
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
from autogen.agentchat.contrib.agent_builder import AgentBuilder
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
sys.path.append(os.path.join(os.path.dirname(__file__), "../.."))
from conftest import reason, skip_openai # noqa: E402
from test_assistant_agent import KEY_LOC, OAI_CONFIG_LIST # noqa: E402
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
try:
import chromadb
import huggingface_hub
except ImportError:
skip = True
else:
skip = False
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
here = os.path.abspath(os.path.dirname(__file__))
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
def _config_check(config):
# check config loading
assert config.get("coding", None) is not None
assert config.get("default_llm_config", None) is not None
assert config.get("code_execution_config", None) is not None
for agent_config in config["agent_configs"]:
assert agent_config.get("name", None) is not None
assert agent_config.get("model", None) is not None
assert agent_config.get("description", None) is not None
assert agent_config.get("system_message", None) is not None
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
@pytest.mark.skipif(
skip_openai,
reason=reason,
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
def test_build():
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
builder = AgentBuilder(
config_file_or_env=OAI_CONFIG_LIST, config_file_location=KEY_LOC, builder_model="gpt-4", agent_model="gpt-4"
)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
building_task = (
"Find a paper on arxiv by programming, and analyze its application in some domain. "
"For example, find a recent paper about gpt-4 on arxiv "
"and find its potential applications in software."
)
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
agent_list, agent_config = builder.build(
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
building_task=building_task,
default_llm_config={"temperature": 0},
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
_config_check(agent_config)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
# check number of agents
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
assert len(agent_config["agent_configs"]) <= builder.max_agents
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
@pytest.mark.skipif(
skip_openai or skip,
reason=reason + "OR dependency not installed",
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
)
def test_build_from_library():
builder = AgentBuilder(
config_file_or_env=OAI_CONFIG_LIST, config_file_location=KEY_LOC, builder_model="gpt-4", agent_model="gpt-4"
)
building_task = (
"Find a paper on arxiv by programming, and analyze its application in some domain. "
"For example, find a recent paper about gpt-4 on arxiv "
"and find its potential applications in software."
)
agent_list, agent_config = builder.build_from_library(
building_task=building_task,
library_path_or_json=f"{here}/example_agent_builder_library.json",
default_llm_config={"temperature": 0},
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
)
_config_check(agent_config)
# check number of agents
assert len(agent_config["agent_configs"]) <= builder.max_agents
builder.clear_all_agents()
# test embedding similarity selection
agent_list, agent_config = builder.build_from_library(
building_task=building_task,
library_path_or_json=f"{here}/example_agent_builder_library.json",
default_llm_config={"temperature": 0},
embedding_model="all-mpnet-base-v2",
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
)
_config_check(agent_config)
# check number of agents
assert len(agent_config["agent_configs"]) <= builder.max_agents
@pytest.mark.skipif(
skip_openai,
reason=reason,
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
def test_save():
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
builder = AgentBuilder(
config_file_or_env=OAI_CONFIG_LIST, config_file_location=KEY_LOC, builder_model="gpt-4", agent_model="gpt-4"
)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
building_task = (
"Find a paper on arxiv by programming, and analyze its application in some domain. "
"For example, find a recent paper about gpt-4 on arxiv "
"and find its potential applications in software."
)
builder.build(
building_task=building_task,
default_llm_config={"temperature": 0},
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
saved_files = builder.save(f"{here}/example_save_agent_builder_config.json")
# check config file path
assert os.path.isfile(saved_files)
saved_configs = json.load(open(saved_files))
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
_config_check(saved_configs)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
@pytest.mark.skipif(
skip_openai,
reason=reason,
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
def test_load():
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
builder = AgentBuilder(
config_file_or_env=OAI_CONFIG_LIST, config_file_location=KEY_LOC, builder_model="gpt-4", agent_model="gpt-4"
)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
config_save_path = f"{here}/example_test_agent_builder_config.json"
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
json.load(open(config_save_path, "r"))
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
agent_list, loaded_agent_configs = builder.load(
config_save_path,
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
print(loaded_agent_configs)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
_config_check(loaded_agent_configs)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
@pytest.mark.skipif(
skip_openai,
reason=reason,
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
def test_clear_agent():
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
builder = AgentBuilder(
config_file_or_env=OAI_CONFIG_LIST, config_file_location=KEY_LOC, builder_model="gpt-4", agent_model="gpt-4"
)
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
config_save_path = f"{here}/example_test_agent_builder_config.json"
builder.load(
config_save_path,
code_execution_config={
"last_n_messages": 2,
"work_dir": f"{here}/test_agent_scripts",
"timeout": 60,
"use_docker": "python:3",
},
Testing AutoBuild (#846) * init notebook for agent set up * complete AgentCreator * AgentCreator first step features completed. * update AgentCreator * update AgentCreator * update AgentCreator (modify params of build) * [update AgentCreator] add auto judgement of coding * add autobuild * rename autobuild notebook * Add step-by-step command. * modify name * fix bugs * update for new openai api * add example * add load_config, save_config, and add task in build and start * modify notebook * rewrite save and load function; update notebook * update description * update description * update description * change member variable of agent_creator.py * update notebook * new feature: auto-generate agent name and system message * new feature: add gpts support * update notebook * update notebook * beautify; add docstring for build * Update notebook; PR version * typo * update notebook * fix typo * try to run llama * try to run llama * switch api_base to base_url * add details for Step 6; add print in clear_all_agents() * Change description of Step 5 * delete ASSISTANT_CONFIG_LIST * add Linxin to blog authors * add blog * Update index.mdx * add test; add user proxy constrain; change show case in notebook * modify blog for test * change test file name; modify test * modify test * modify test * add try/catch for dependency * add version requirement for openai * add exception for DistributionNotFound error * add requirement * change assertion * rename test; modify index.mdx * change config file name * Update agent_chat.md * Update agent_chat.md * Update AgentChat.md * complete blog; fix typos in notebook * add autobuild banner * try to merge * Update Examples.md * update test * skip if openai not installed * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Chi Wang <wang.chi@microsoft.com> * update contrib-openai.yml * change pull_request_target to pull_request * disable other openai tests * address issues from ekzhu; modify notebook; modify blog; modify test * update test example * update test * Update agent_chat.md * Update Examples.md * address issues from qingyun; update agent_builder.py; update notebook * recover contrib-openai.yml * pre-commit solve --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: JieyuZ2 <jieyuzhang97@gmail.com> Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2023-12-04 11:12:26 +09:00
)
builder.clear_all_agents()
# check if the agent cleared
assert len(builder.agent_procs_assign) == 0
[AutoBuild] Supporting build agents from library; supporting generating agent descriptions (#1039) * try to fix blog * modify blog * fix test error in #717; fix blog typo in installation; update blogs with output examples. * pre-commit * pre-commit * Update website/blog/2023-11-26-Agent-AutoBuild/index.mdx Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> * add future work * fix grammar * update agent_builder * solve #941; add detailed debug info; support json string config * pre-commit * solve #954 * pre-commit * [new feature] build group chat agents from library. * pre-commit * add authors' info in notebook; add a new notebook for build_from_library; reduce prompt effort * update test and example for build_from_library * pre-commit * add notebook; update docs * change notebook name * change description for notebook and doc * remove default value for default_llm_config * add embedding similarity agent selection * pre-commit * update test * add dependency installation in github workflow * update test * pre-commit * update notebook * support directly json as library; support customize embedding model * update test * pre-commit * update github test workflow * Update autobuild_agent_library.ipynb * add agent description * refine prompt; update notebook * pre-commit * update test example * update test * update test * update test * change `config_path` to `config_path_or_env`; update test * pre-commit * update test * update test * update test: add config_file_location * change `config_path_or_env` to `config_file_or_env` * update test * solve noqa * fix import error for conftest * fix test error * pre-commit * * update error message in `_create_agent`. * replace `gpt-4-1106-preview` to `gpt-4` in test file. * add comment on local server creation; modify notebook; update contrib-openai.yml for test; add autobuild option in setup.py; add autotest model name statement * move import huggingface_hub to _create_agent * pre-commit * add uncover comment in the endpoint creation code block * recover contrib-openai.yml for merge --------- Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
2024-01-07 02:23:23 +09:00
if __name__ == "__main__":
test_build()
test_build_from_library()
test_save()
test_load()
test_clear_agent()