Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workdir in test #1274

Merged
merged 4 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion notebook/agentchat_auto_feedback_from_code_execution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,10 @@
}
],
"source": [
"Image(filename=\"coding/stock_price_ytd.png\")"
"try:\n",
" Image(filename=\"coding/stock_price_ytd.png\")\n",
"except FileNotFoundError:\n",
" print(\"Image not found. Please check the file name and modify if necessary.\")"
]
},
{
Expand Down
11 changes: 9 additions & 2 deletions test/agentchat/test_assistant_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ def test_create_execute_script(human_input_mode="NEVER", max_consecutive_auto_re
message="""Create and execute a script to plot a rocket without using matplotlib""",
)
assistant.reset()
user = UserProxyAgent(
"user",
human_input_mode=human_input_mode,
code_execution_config={"work_dir": f"{here}/test_agent_scripts"},
max_consecutive_auto_reply=max_consecutive_auto_reply,
is_termination_msg=lambda x: x.get("content", "").rstrip().endswith("TERMINATE"),
)
user.initiate_chat(
assistant,
message="""Create a temp.py file with the following content:
Expand Down Expand Up @@ -197,8 +204,8 @@ def generate_init_message(self, question) -> str:

if __name__ == "__main__":
# test_gpt35()
# test_create_execute_script(human_input_mode="TERMINATE")
test_create_execute_script(human_input_mode="TERMINATE")
# when GPT-4, i.e., the DEFAULT_MODEL, is used, conversation in the following test
# should terminate in 2-3 rounds of interactions (because is_termination_msg should be true after 2-3 rounds)
# although the max_consecutive_auto_reply is set to 10.
test_tsp(human_input_mode="NEVER", max_consecutive_auto_reply=10)
# test_tsp(human_input_mode="NEVER", max_consecutive_auto_reply=10)
Loading