Skip to content

Commit

Permalink
Change default model and config loading process in AgentBuilder (micr…
Browse files Browse the repository at this point in the history
…osoft#917)

* try to fix blog

* modify blog

* fix test error in microsoft#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

---------

Co-authored-by: Jieyu Zhang <jieyuz2@cs.washington.edu>
Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
  • Loading branch information
3 people committed Dec 8, 2023
1 parent 3fac8c8 commit 23d2948
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions autogen/agentchat/contrib/agent_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ class AgentBuilder:
def __init__(
self,
config_path: Optional[str] = "OAI_CONFIG_LIST",
builder_model: Optional[str] = "gpt-4-1106-preview",
agent_model: Optional[str] = "gpt-4-1106-preview",
builder_model: Optional[str] = "gpt-4",
agent_model: Optional[str] = "gpt-4",
host: Optional[str] = "localhost",
endpoint_building_timeout: Optional[int] = 600,
):
Expand Down Expand Up @@ -277,10 +277,10 @@ def build(
coding = cached_configs["coding"]
agent_configs = cached_configs["agent_configs"]

config_list = autogen.config_list_from_json(self.config_path, filter_dict={"model": [self.builder_model]})
build_manager = autogen.OpenAIWrapper(config_list=config_list)

if use_api:
config_list = autogen.config_list_from_json(self.config_path, filter_dict={"model": [self.builder_model]})
build_manager = autogen.OpenAIWrapper(config_list=config_list)

print("Generating agents...")
resp_agent_name = (
build_manager.create(
Expand Down Expand Up @@ -323,6 +323,16 @@ def build(
{"name": agent_name_list[i], "model": self.agent_model, "system_message": agent_sys_msg_list[i]}
)

if coding is None:
resp = (
build_manager.create(
messages=[{"role": "user", "content": self.CODING_PROMPT.format(task=building_task)}]
)
.choices[0]
.message.content
)
coding = True if resp == "YES" else False

for config in agent_configs:
print(f"Creating agent {config['name']} with backbone {config['model']}...")
self._create_agent(
Expand All @@ -335,16 +345,6 @@ def build(
)
agent_list = [agent_config[0] for agent_config in self.agent_procs_assign.values()]

if coding is None:
resp = (
build_manager.create(
messages=[{"role": "user", "content": self.CODING_PROMPT.format(task=building_task)}]
)
.choices[0]
.message.content
)
coding = True if resp == "YES" else False

if coding is True:
print("Adding user console proxy...")
agent_list = [
Expand Down

0 comments on commit 23d2948

Please sign in to comment.