Skip to content

Commit 23d2948

Browse files
LinxinS97JieyuZ2qingyun-wu
authored
Change default model and config loading process in AgentBuilder (microsoft#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 <[email protected]> * add future work * fix grammar * update agent_builder --------- Co-authored-by: Jieyu Zhang <[email protected]> Co-authored-by: Qingyun Wu <[email protected]>
1 parent 3fac8c8 commit 23d2948

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

autogen/agentchat/contrib/agent_builder.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class AgentBuilder:
6060
def __init__(
6161
self,
6262
config_path: Optional[str] = "OAI_CONFIG_LIST",
63-
builder_model: Optional[str] = "gpt-4-1106-preview",
64-
agent_model: Optional[str] = "gpt-4-1106-preview",
63+
builder_model: Optional[str] = "gpt-4",
64+
agent_model: Optional[str] = "gpt-4",
6565
host: Optional[str] = "localhost",
6666
endpoint_building_timeout: Optional[int] = 600,
6767
):
@@ -277,10 +277,10 @@ def build(
277277
coding = cached_configs["coding"]
278278
agent_configs = cached_configs["agent_configs"]
279279

280-
config_list = autogen.config_list_from_json(self.config_path, filter_dict={"model": [self.builder_model]})
281-
build_manager = autogen.OpenAIWrapper(config_list=config_list)
282-
283280
if use_api:
281+
config_list = autogen.config_list_from_json(self.config_path, filter_dict={"model": [self.builder_model]})
282+
build_manager = autogen.OpenAIWrapper(config_list=config_list)
283+
284284
print("Generating agents...")
285285
resp_agent_name = (
286286
build_manager.create(
@@ -323,6 +323,16 @@ def build(
323323
{"name": agent_name_list[i], "model": self.agent_model, "system_message": agent_sys_msg_list[i]}
324324
)
325325

326+
if coding is None:
327+
resp = (
328+
build_manager.create(
329+
messages=[{"role": "user", "content": self.CODING_PROMPT.format(task=building_task)}]
330+
)
331+
.choices[0]
332+
.message.content
333+
)
334+
coding = True if resp == "YES" else False
335+
326336
for config in agent_configs:
327337
print(f"Creating agent {config['name']} with backbone {config['model']}...")
328338
self._create_agent(
@@ -335,16 +345,6 @@ def build(
335345
)
336346
agent_list = [agent_config[0] for agent_config in self.agent_procs_assign.values()]
337347

338-
if coding is None:
339-
resp = (
340-
build_manager.create(
341-
messages=[{"role": "user", "content": self.CODING_PROMPT.format(task=building_task)}]
342-
)
343-
.choices[0]
344-
.message.content
345-
)
346-
coding = True if resp == "YES" else False
347-
348348
if coding is True:
349349
print("Adding user console proxy...")
350350
agent_list = [

0 commit comments

Comments
 (0)