Update multi_agent.py
Browse files- multi_agent.py +11 -3
multi_agent.py
CHANGED
@@ -21,7 +21,7 @@ def format_as_markdown(code: str) -> str:
|
|
21 |
markdown_code += '\n```'
|
22 |
return markdown_code
|
23 |
|
24 |
-
def run_multi_agent(llm,
|
25 |
llm_config = {"model": llm}
|
26 |
|
27 |
executor = LocalCommandLineCodeExecutor(
|
@@ -46,7 +46,7 @@ def run_multi_agent(llm, message):
|
|
46 |
|
47 |
chat_result = code_executor_agent.initiate_chat(
|
48 |
code_writer_agent,
|
49 |
-
message=
|
50 |
max_turns=10
|
51 |
)
|
52 |
|
@@ -57,8 +57,16 @@ def run_multi_agent(llm, message):
|
|
57 |
if not first_message:
|
58 |
chat += f"**{message['role'].replace('assistant', 'Code Executor').replace('user', 'Code Writer')}**\n{message['content']}\n\n"
|
59 |
first_message = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
-
image_data = read_image_file("/home/user/app/coding/
|
62 |
markdown_code_png = generate_markdown_image(image_data)
|
63 |
|
64 |
result = f"{markdown_code_png}\n\n{chat}"
|
|
|
21 |
markdown_code += '\n```'
|
22 |
return markdown_code
|
23 |
|
24 |
+
def run_multi_agent(llm, task):
|
25 |
llm_config = {"model": llm}
|
26 |
|
27 |
executor = LocalCommandLineCodeExecutor(
|
|
|
46 |
|
47 |
chat_result = code_executor_agent.initiate_chat(
|
48 |
code_writer_agent,
|
49 |
+
message=task,
|
50 |
max_turns=10
|
51 |
)
|
52 |
|
|
|
57 |
if not first_message:
|
58 |
chat += f"**{message['role'].replace('assistant', 'Code Executor').replace('user', 'Code Writer')}**\n{message['content']}\n\n"
|
59 |
first_message = False
|
60 |
+
|
61 |
+
file_name_png = ""
|
62 |
+
|
63 |
+
for file in os.listdir("coding"):
|
64 |
+
if file:
|
65 |
+
_, file_extension = os.path.splitext(file)
|
66 |
+
if file_extension == ".png":
|
67 |
+
file_name_png = file
|
68 |
|
69 |
+
image_data = read_image_file(f"/home/user/app/coding/{file_name_png}")
|
70 |
markdown_code_png = generate_markdown_image(image_data)
|
71 |
|
72 |
result = f"{markdown_code_png}\n\n{chat}"
|