shroominic / codeinterpreter-api

👾 Open source implementation of the ChatGPT Code Interpreter
https://discord.gg/Vaq25XJvvW
MIT License
3.79k stars 402 forks source link

GPT-4 Support #132

Open nazkhan-8451 opened 1 year ago

nazkhan-8451 commented 1 year ago

Getting this error for gpt-4.

deployment_id = 'gpt-4' 
with CodeInterpreterSession(deployment_id = deployment_id) as session:
INFO: Using a LocalBox which is not fully isolated
      and not scalable across multiple users.
      Make sure to use a CODEBOX_API_KEY in production.
      Set envar SHOW_INFO=False to not see this again.

AI:  Error in CodeInterpreterSession: InvalidRequestError  - Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.chat_completion.ChatCompletion'>
nazkhan-8451 commented 1 year ago

after setting environment variables correctly and changing deployment name to "gpt-35-turbo-16k"

# # create a session
# with CodeInterpreterSession() as session:
#     # generate a response based on user input
#     response = session.generate_response(
#         "Plot the bitcoin chart of year 2023"
#     )

#     # output the response
#     response.show()

AI:  Error in CodeInterpreterSession: InvalidRequestError  - Unrecognized request argument supplied: functions
from codeinterpreterapi import CodeInterpreterSession

async def main():
    async with CodeInterpreterSession() as session:
        response = await session.agenerate_response(
            "Plot a sin wave and show it to me."
        )
        response.show()

if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

Error message:
RuntimeError                              Traceback (most recent call last)
Cell In[38], line 14
     11 if __name__ == "__main__":
     12     import asyncio
---> 14     asyncio.run(main())

File [~/miniconda3/envs/open-code-interpreter/lib/python3.10/asyncio/runners.py:33](https://file+.vscode-resource.vscode-cdn.net/Users/n940767/Documents/Code-projects/gpt-work/~/miniconda3/envs/open-code-interpreter/lib/python3.10/asyncio/runners.py:33), in run(main, debug)
      9 """Execute the coroutine and return the result.
     10 
     11 This function runs the passed coroutine, taking care of
   (...)
     30     asyncio.run(main())
     31 """
     32 if events._get_running_loop() is not None:
---> 33     raise RuntimeError(
     34         "asyncio.run() cannot be called from a running event loop")
     36 if not coroutines.iscoroutine(main):
     37     raise ValueError("a coroutine was expected, got {!r}".format(main))

RuntimeError: asyncio.run() cannot be called from a running event loop
nazkhan-8451 commented 1 year ago

This is also happening for OpenAI Api Key also.