forked from shroominic/codeinterpreter-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π¨π»βπ¬ dataset analysis example
- Loading branch information
1 parent
b706710
commit 11d77f8
Showing
1 changed file
with
29 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from codeinterpreterapi import CodeInterpreterSession | ||
from codeinterpreterapi.schema import File | ||
|
||
|
||
async def main(): | ||
# context manager for start/stop of the session | ||
async with CodeInterpreterSession() as session: | ||
# define the user request | ||
user_request = "Analyze this dataset and plot something interesting about it." | ||
files = [ | ||
File.from_path("examples/assets/iris.csv"), | ||
] | ||
|
||
# generate the response | ||
response = await session.generate_response( | ||
user_request, files=files | ||
) | ||
|
||
# ouput the response (text + image) | ||
print("AI: ", response.content) | ||
for file in response.files: | ||
file.show_image() | ||
|
||
|
||
if __name__ == "__main__": | ||
import asyncio | ||
|
||
# run the async function | ||
asyncio.run(main()) |