Skip to content

Commit

Permalink
Init Autogen integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ctavolazzi committed Feb 4, 2024
1 parent 4126ae7 commit 1fcac6e
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
18 changes: 18 additions & 0 deletions un-spaghettified/core/coding/stock_price_chart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# filename: stock_price_chart.py
import yfinance as yf
import matplotlib.pyplot as plt

# Define the ticker symbols for NVDA and TESLA
tickers = ['NVDA', 'TSLA']

# Fetch the historical stock price data for YTD
data = yf.download(tickers, start='2021-01-01', end='2021-12-31')

# Extract the 'Close' price column for each ticker
close_prices = data['Close']

# Plot the stock price change YTD
close_prices.plot(title='Stock Price Change YTD', ylabel='Price (USD)')

# Display the chart
plt.show()
19 changes: 19 additions & 0 deletions un-spaghettified/core/stock_price_chart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

# filename: stock_price_chart.py
import yfinance as yf
import matplotlib.pyplot as plt

# Define the ticker symbols for NVDA and TESLA
tickers = ['NVDA', 'TSLA']

# Fetch the historical stock price data for YTD
data = yf.download(tickers, start='2021-01-01', end='2021-12-31')

# Extract the 'Close' price column for each ticker
close_prices = data['Close']

# Plot the stock price change YTD
close_prices.plot(title='Stock Price Change YTD', ylabel='Price (USD)')

# Display the chart
plt.show()
38 changes: 38 additions & 0 deletions un-spaghettified/core/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import sys
from autogen import AssistantAgent, UserProxyAgent
from dotenv import load_dotenv
import os

# Load the .env info
load_dotenv()
api_key = os.getenv('OPENAI_API_KEY')

print(sys.path)
print("pyautogen imported successfully")

config_list = [
{
"model": "gpt-3.5-turbo",
"api_key": api_key
}
# Add more configurations if needed
]

# Create AssistantAgent with the llm_config
assistant = AssistantAgent(
name="assistant",
llm_config={
"seed": 42,
"config_list": config_list,
"temperature": 0,
}
)

# Create a UserProxyAgent with configuration for code execution
user_proxy = UserProxyAgent(
name="user_proxy",
code_execution_config={"work_dir": "coding", "use_docker": False} # Set to True to run code in docker
)

# Initiate a chat between the two agents to perform a task
user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.")

0 comments on commit 1fcac6e

Please sign in to comment.