ricklamers / gpt-code-ui

An open source implementation of OpenAI's ChatGPT Code interpreter
MIT License
3.56k stars 447 forks source link

Dev/use openai package #63

Closed dasmy closed 1 year ago

dasmy commented 1 year ago

Hi @ricklamers, This change switches from plain Python requests to using the official openai package. While this introduces an additional dependency, it very much standardizes the used interface, shortens the code, and simplifies error handling. Imho, this will help keeping the tool up-to-date as, e.g., changes to the official API will be supported automatically.

With this change, I also introduced the possibility to supply additional user-defined headers. This is also possible in many other packages that interact with the openAI API to, e.g., firewalls, internal gateway server and the like.

What do you think about this?

ricklamers commented 1 year ago

This is great! LGTM