赞
踩
AutoGen是一个让LLM(大语言模型)相互聊天过程中解决任务的框架,可定制、可对话,并允许人类无缝参与。
直接上干货,了解AutoGen,并能运行。
参考博客:https://blog.csdn.net/techforward/article/details/133863795,了解主要介绍,下面直接给出所需步骤。
#注释原代码config_list = 所在行
#config_list = config_list_from_json(env_or_file="OAI_CONFIG_LIST")
#加入如下语句,注意api_key后面的key为你要用的openai的key,默认是14天有效的那个。后面*号是因为太长了省略了,这个一定要用有效的,重要的东西重复一遍。
config_list = [{'model': 'gpt-3.5-turbo', 'api_key': 'eyJhbGciOiJSUzI1NiIsInR5c***'},]
如图所示:
前提安装好python3.8以上版本。在AutoGen目录下执行:
user_proxy (to assistant): Plot a chart of NVDA and TESLA stock price change YTD. -------------------------------------------------------------------------------- assistant (to user_proxy): To plot the chart of NVDA and TESLA stock price change Year-to-Date (YTD), we need to first collect the historical stock prices for both NVDA and TESLA. There are various APIs and libraries available to fetch stock prices. In this case, I will use the yfinance library to retrieve the stock prices. Here is the Python code to accomplish this: ```python # filename: stock_price_chart.py import yfinance as yf import matplotlib.pyplot as plt # Define the ticker symbols for NVDA and TSLA nvda = yf.Ticker("NVDA") tsla = yf.Ticker("TSLA") # Get the historical stock prices for YTD nvda_hist = nvda.history(period="YTD") tsla_hist = tsla.history(period="YTD") # Plotting the stock price changes fig, ax = plt.subplots() ax.plot(nvda_hist.index, nvda_hist["Close"], label="NVDA") ax.plot(tsla_hist.index, tsla_hist["Close"], label="TESLA") ax.set_title("YTD Stock Price Change") ax.set_xlabel("Date") ax.set_ylabel("Stock Price") ax.legend() # Display the chart plt.show()
Please make sure you have the following libraries installed:
You can install the libraries using pip:
pip install yfinance matplotlib
Save the code in a file named stock_price_chart.py
, then execute it. The code will retrieve the historical stock prices for NVDA and TESLA for the current year and plot a chart showing the stock price changes.
Let me know if you need any further assistance!
Provide feedback to assistant. Press enter to skip and use auto-reply, or type ‘exit’ to end the conversation:
以上为输出内容;
[1]: https://github.com/microsoft/autogen
[2]: https://microsoft.github.io/autogen/docs/Getting-Started
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。