santiagobasulto / ipython-gpt

An ChatGPT integration for Jupyter Notebooks and the IPython Shell
MIT License
595 stars 40 forks source link

Improvements planned/needed #4

Open santiagobasulto opened 1 year ago

santiagobasulto commented 1 year ago

Code design and architecture

Code quality

Feature improvements

12rambau commented 1 year ago

can we help ? I'm not too bad at packaging.

Note that "ipygpt" is available for both conda and pypi

santiagobasulto commented 1 year ago

Yes! Definitively! I was going to start with the proper breakup of the different commands, and some testing. But any of the points above are out for the grab if you have some time.

Do you think ipygpt is a better name than ipython-gpt?

12rambau commented 1 year ago

it's easier to type and lots of interactive libs have ipy in ther name: ipyleaflet, ipyvuetify, ipywidget ...

it also avoids the issue with pip that is forcing "-" in lib name as separator (sepal-ui and sepalui is the same) and python forcing "" when importing (you can import sepal_ui but can't import sepal-ui)

12rambau commented 1 year ago

I'll send few packaging PR in the upcoming days then, I'm thinking about pre-commit, nox and a sphinx based simple documentation what do you think ?

santiagobasulto commented 1 year ago

šŸ‘ perf, I'll mention you in this issue once i push the new subcommands so you're aware of it.

barlownet commented 1 year ago

How would you recommend capturing output into a string?

itissid commented 1 year ago

Added streaming support: https://github.com/santiagobasulto/ipython-gpt/pull/12

Major changes are:

  1. I noticed that the code base uses http.client which does not have Event Stream support quite like (https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb) therequests library. I think it would be much easier to just use requests than to implement logic wrapping http.client to handle these.

  2. To stream we need layers of generators that can process the streaming response in a pythonic way, I have made the execute method of the ChatCommand and the Http Client library do that.

  3. Added some unit tests as well to support streaming.