from autogen import ConversableAgent, AssistantAgent
from autogen.coding import LocalCommandLineCodeExecutor
import os
#from IPython.display import Image
def run_multi_agent(llm, message):
llm_config = {"model": llm}
executor = LocalCommandLineCodeExecutor(
timeout=60,
work_dir="coding",
)
code_executor_agent = ConversableAgent(
name="code_executor_agent",
llm_config=False,
code_execution_config={"executor": executor},
human_input_mode="NEVER",
default_auto_reply=
"Please continue. If everything is done, reply 'TERMINATE'.",
)
code_writer_agent = AssistantAgent(
name="code_writer_agent",
llm_config=llm_config,
code_execution_config=False,
human_input_mode="NEVER",
)
code_writer_agent_system_message = code_writer_agent.system_message
print(code_writer_agent_system_message)
chat_result = code_executor_agent.initiate_chat(
code_writer_agent,
message=message,
max_turns=10
)
###
#for root, dirs, files in os.walk("."):
# for file in files:
# print(os.path.join(root, file))
###
#png_file = os.path.join("coding", "ytd_stock_gains.png")
#print("### "+png_file)
current_folder = os.getcwd()
files_in_folder = os.listdir(current_folder)
print(f"Files in {current_folder}:")
for file in files_in_folder:
print(file)
image_path = "/home/user/app/coding/ytd_stock_gains.png"
image_path_2 = "/coding/ytd_stock_gains.png"
image_path_5 = "coding/ytd_stock_gains.png"
image_path_3 = "/app/coding/ytd_stock_gains.png"
image_path_4 = "/user/app/coding/ytd_stock_gains.png"
return f"




"