Skip to content

Commit

Permalink
pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
LinxinS97 committed Dec 11, 2023
1 parent e63044e commit c2816a5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions autogen/agentchat/contrib/agent_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@

def _config_check(config: Dict):
# check config loading
assert config.get('coding', None) is not None, "Missing \"coding\" in your config."
assert config.get('default_llm_config', None) is not None, "Missing \"default_llm_config\" in your config."
assert config.get('code_execution_config', None) is not None, "Missing \"code_execution_config\" in your config."
assert config.get("coding", None) is not None, 'Missing "coding" in your config.'
assert config.get("default_llm_config", None) is not None, 'Missing "default_llm_config" in your config.'
assert config.get("code_execution_config", None) is not None, 'Missing "code_execution_config" in your config.'

for agent_config in config["agent_configs"]:
assert agent_config.get('name', None) is not None, "Missing agent \"name\" in your agent_configs."
assert agent_config.get('model', None) is not None, "Missing agent \"model\" in your agent_configs."
assert agent_config.get('system_message', None) is not None, "Missing agent \"system_message\" in your agent_configs."
assert agent_config.get("name", None) is not None, 'Missing agent "name" in your agent_configs.'
assert agent_config.get("model", None) is not None, 'Missing agent "model" in your agent_configs.'
assert (
agent_config.get("system_message", None) is not None
), 'Missing agent "system_message" in your agent_configs.'


class AgentBuilder:
Expand Down Expand Up @@ -150,7 +152,7 @@ def _create_agent(
if len(config_list) == 0:
raise RuntimeError(
f"Fail to initialize agent:{agent_name}: {self.builder_model} does not exist in {self.config_path}. "
f"If you would like to change this model, please specify the \"agent_model\" in the constructor."
f'If you would like to change this model, please specify the "agent_model" in the constructor.'
)
if "gpt-" in model_name_or_hf_repo:
server_id = self.openai_server_name
Expand Down Expand Up @@ -306,7 +308,7 @@ def build(
if len(config_list) == 0:
raise RuntimeError(
f"Fail to initialize build manager: {self.builder_model} does not exist in {self.config_path}. "
f"If you want to change this model, please specify the \"builder_model\" in the constructor."
f'If you want to change this model, please specify the "builder_model" in the constructor.'
)
build_manager = autogen.OpenAIWrapper(config_list=config_list)

Expand All @@ -323,7 +325,7 @@ def build(
.choices[0]
.message.content
)
agent_name_list = [agent_name.strip().replace(' ', '_') for agent_name in resp_agent_name.split(",")]
agent_name_list = [agent_name.strip().replace(" ", "_") for agent_name in resp_agent_name.split(",")]
print(f"{agent_name_list} are generated.")

agent_sys_msg_list = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
"timeout": 60,
"use_docker": false
}
}
}

0 comments on commit c2816a5

Please sign in to comment.