Update multi_agent.py
Browse files- multi_agent.py +15 -0
multi_agent.py
CHANGED
|
@@ -3,6 +3,11 @@ import base64, datetime, json, os
|
|
| 3 |
from autogen import ConversableAgent, AssistantAgent
|
| 4 |
from autogen.coding import LocalCommandLineCodeExecutor
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
def read_file(file_path: str) -> str:
|
| 7 |
with open(file_path, "r", encoding="utf-8") as file:
|
| 8 |
return file.read()
|
|
@@ -61,6 +66,16 @@ def run_multi_agent(llm, task):
|
|
| 61 |
code_execution_config=False,
|
| 62 |
human_input_mode="NEVER",
|
| 63 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
|
| 65 |
chat_result = code_executor_agent.initiate_chat(
|
| 66 |
code_writer_agent,
|
|
|
|
| 3 |
from autogen import ConversableAgent, AssistantAgent
|
| 4 |
from autogen.coding import LocalCommandLineCodeExecutor
|
| 5 |
|
| 6 |
+
###
|
| 7 |
+
def get_today() -> Annotated[str, "Get today's date"]:
|
| 8 |
+
return str(date.today())
|
| 9 |
+
###
|
| 10 |
+
|
| 11 |
def read_file(file_path: str) -> str:
|
| 12 |
with open(file_path, "r", encoding="utf-8") as file:
|
| 13 |
return file.read()
|
|
|
|
| 66 |
code_execution_config=False,
|
| 67 |
human_input_mode="NEVER",
|
| 68 |
)
|
| 69 |
+
|
| 70 |
+
###
|
| 71 |
+
register_function(
|
| 72 |
+
get_today,
|
| 73 |
+
caller=code_writer_agent,
|
| 74 |
+
executor=code_writer_agent,
|
| 75 |
+
name="get_today",
|
| 76 |
+
description="Call this tool to get today's date.",
|
| 77 |
+
)
|
| 78 |
+
###
|
| 79 |
|
| 80 |
chat_result = code_executor_agent.initiate_chat(
|
| 81 |
code_writer_agent,
|