Skip to content

Commit afd854a

Browse files
committed
🧼 simplify examples
1 parent ace6440 commit afd854a

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

examples/analyze_dataset.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ async def main():
1414
response = await session.generate_response(user_request, files=files)
1515

1616
# output the response (text + image)
17-
print("AI: ", response.content)
18-
for file in response.files:
19-
file.show_image()
17+
response.show()
2018

2119

2220
if __name__ == "__main__":

examples/plot_sin_wave.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ async def main():
55
async with CodeInterpreterSession() as session:
66
response = await session.generate_response("Plot a sin wave and show it to me.")
77

8-
print("AI: ", response.content)
9-
for file in response.files:
10-
file.show_image()
8+
response.show()
119

1210

1311
if __name__ == "__main__":

examples/show_bitcoin_chart.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
"""
2-
The exciting part about this example is
3-
that the code interpreter has internet access
4-
so it can download the bitcoin chart from yahoo finance
5-
and plot it for you
6-
"""
7-
81
from datetime import datetime
92

103
from codeinterpreterapi import CodeInterpreterSession
@@ -18,9 +11,8 @@ async def main():
1811
f"Plot the bitcoin chart of 2023 YTD (today is {currentdate})"
1912
)
2013

21-
print("AI: ", response.content)
22-
for file in response.files:
23-
file.show_image()
14+
# prints the text and shows the image
15+
response.show()
2416

2517

2618
if __name__ == "__main__":

examples/use_additional_tools.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ async def main():
3737
"Plot chart of company employee salaries"
3838
)
3939

40-
print("AI: ", response.content)
41-
for file in response.files:
42-
file.show_image()
40+
response.show()
4341

4442

4543
if __name__ == "__main__":

0 commit comments

Comments
 (0)