You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# generate a response based on user input
response = await session.generate_response(
"Plot the bitcoin chart of 2023 YTD"
)
# output the response (text + image)
print("AI: ", response.content)
for file in response.files:
file.show_image()
# terminate the session
await session.astop()
if name == "main":
import asyncio
# run the async function
asyncio.run(main())
I get an error:
C:\Users\igorb\anaconda3\envs\agents\python.exe E:\pet\agents\codeinterpreter.py
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:265: RuntimeWarning: coroutine 'WebSocketCommonProtocol.send' was never awaited
self.ws.send(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "E:\pet\agents\codeinterpreter.py", line 75, in
asyncio.run(main())
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "E:\pet\agents\codeinterpreter.py", line 59, in main
response = await session.generate_response(
TypeError: object CodeInterpreterResponse can't be used in 'await' expression
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:512: RuntimeWarning: coroutine 'Process.wait' was never awaited
Exception ignored in: <function LocalBox.del at 0x0000024808BE3A30>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 567, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 526, in stop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 783, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 673, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\windows_events.py", line 315, in init
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 639, in init
ImportError: sys.meta_path is None, Python is likely shutting down
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002480AEC1D50>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002480AEE0E80>, 351431.296)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002480AEC1BD0>
Exception ignored in: <function BaseSubprocessTransport.del at 0x000002487F1D6DD0>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 126, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 104, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 109, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 753, in call_soon
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed
Process finished with exit code 1
The text was updated successfully, but these errors were encountered:
I'm trying to run the code on Windows 11:
from codeinterpreterapi import CodeInterpreterSession
OPENAI_API_KEY="sk-my Open AI KEY"
async def main():
# create a session
session = CodeInterpreterSession(openai_api_key=OPENAI_API_KEY, model="gpt-3.5-turbo")
await session.astart()
if name == "main":
import asyncio
# run the async function
asyncio.run(main())
I get an error:
C:\Users\igorb\anaconda3\envs\agents\python.exe E:\pet\agents\codeinterpreter.py
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:265: RuntimeWarning: coroutine 'WebSocketCommonProtocol.send' was never awaited
self.ws.send(
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
File "E:\pet\agents\codeinterpreter.py", line 75, in
asyncio.run(main())
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 649, in run_until_complete
return future.result()
File "E:\pet\agents\codeinterpreter.py", line 59, in main
response = await session.generate_response(
TypeError: object CodeInterpreterResponse can't be used in 'await' expression
C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py:512: RuntimeWarning: coroutine 'Process.wait' was never awaited
Exception ignored in: <function LocalBox.del at 0x0000024808BE3A30>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 567, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\site-packages\codeboxapi\box\localbox.py", line 526, in stop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 783, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\events.py", line 673, in new_event_loop
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\windows_events.py", line 315, in init
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 639, in init
ImportError: sys.meta_path is None, Python is likely shutting down
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x000002480AEC1D50>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x000002480AEE0E80>, 351431.296)]']
connector: <aiohttp.connector.TCPConnector object at 0x000002480AEC1BD0>
Exception ignored in: <function BaseSubprocessTransport.del at 0x000002487F1D6DD0>
Traceback (most recent call last):
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 126, in del
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_subprocess.py", line 104, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\proactor_events.py", line 109, in close
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 753, in call_soon
File "C:\Users\igorb\anaconda3\envs\agents\lib\asyncio\base_events.py", line 515, in _check_closed
RuntimeError: Event loop is closed
Process finished with exit code 1
The text was updated successfully, but these errors were encountered: