File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- # TODO: ask the agent to plot the bitcoin chart of 2023 YTD (today is {{currentdate}}) - show the output to the user with PIL.show()
1+ from datetime import datetime
2+ from codeinterpreterapi import CodeInterpreterSession
3+
4+
5+ async def main ():
6+ async with CodeInterpreterSession () as session :
7+ currentdate = datetime .now ().strftime ("%Y-%m-%d" )
8+ user_request = f"Plot the bitcoin chart of 2023 YTD (today is { currentdate } )"
9+
10+ output = await session .generate_response (user_request )
11+
12+ file = output .files [0 ]
13+ file .show_image ()
14+
15+
16+ # The exciting part about this example is
17+ # that the code interpreter has internet access
18+ # so it can download the bitcoin chart from yahoo finance
19+ # and plot it for you
20+
21+
22+ if __name__ == "__main__" :
23+ import asyncio
24+ asyncio .run (main ())
You can’t perform that action at this time.
0 commit comments