-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use script-friendly example in README and quickstart
- Loading branch information
Showing
5 changed files
with
69 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import asyncio | ||
import logging | ||
from autogen_agentchat.agents import CodeExecutorAgent, CodingAssistantAgent | ||
from autogen_agentchat.teams import RoundRobinGroupChat, StopMessageTermination | ||
from autogen_agentchat import EVENT_LOGGER_NAME | ||
from autogen_agentchat.logging import ConsoleLogHandler | ||
from autogen_core.components.code_executor import DockerCommandLineCodeExecutor | ||
from autogen_core.components.models import OpenAIChatCompletionClient | ||
|
||
logger = logging.getLogger(EVENT_LOGGER_NAME) | ||
logger.addHandler(ConsoleLogHandler()) | ||
logger.setLevel(logging.INFO) | ||
|
||
async def main() -> None: | ||
async with DockerCommandLineCodeExecutor(work_dir="coding") as code_executor: | ||
code_executor_agent = CodeExecutorAgent("code_executor", code_executor=code_executor) | ||
coding_assistant_agent = CodingAssistantAgent( | ||
"coding_assistant", model_client=OpenAIChatCompletionClient(model="gpt-4o") | ||
) | ||
group_chat = RoundRobinGroupChat([coding_assistant_agent, code_executor_agent]) | ||
result = await group_chat.run( | ||
task="Create a plot of NVDIA and TSLA stock returns YTD from 2024-01-01 and save it to 'nvidia_tesla_2024_ytd.png'.", | ||
termination_condition=StopMessageTermination(), | ||
) | ||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters