From 31cffc2621b8e6bf575626a7d536c7ae50863b2c Mon Sep 17 00:00:00 2001 From: Johnny Oshika Date: Wed, 29 May 2024 08:24:03 -0700 Subject: [PATCH] Add 2_plot_stock_charts.py --- 2_plot_stock_charts.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 2_plot_stock_charts.py diff --git a/2_plot_stock_charts.py b/2_plot_stock_charts.py new file mode 100644 index 0000000..75d84dc --- /dev/null +++ b/2_plot_stock_charts.py @@ -0,0 +1,23 @@ +# https://github.com/microsoft/autogen/blob/main/test/twoagent.py + +import os +from dotenv import load_dotenv +# For 'import autogen' to work, had to 'pip install packaging' +from autogen import AssistantAgent, UserProxyAgent + +load_dotenv() + +llm_config = { + 'model': 'gpt-4o', + 'api_key': os.getenv('OPENAI_API_KEY'), + 'base_url': os.getenv('OPENAI_BASE_URL') if os.getenv('OPENAI_BASE_URL') else None, +} + +assistant = AssistantAgent("assistant", llm_config=llm_config) + +user_proxy = UserProxyAgent( + "user_proxy", code_execution_config={"work_dir": "coding", "use_docker": True} +) + +user_proxy.initiate_chat( + assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")