Open santiagobasulto opened 1 year ago
can we help ? I'm not too bad at packaging.
Note that "ipygpt" is available for both conda and pypi
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
?
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
)
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 ?
š perf, I'll mention you in this issue once i push the new subcommands so you're aware of it.
How would you recommend capturing output into a string?
Added streaming support: https://github.com/santiagobasulto/ipython-gpt/pull/12
Major changes are:
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.
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.
Added some unit tests as well to support streaming.
Code design and architecture
requests.Session
while keeping the OpenAI API Key in some context to avoid the repetitionIPythonGPT
class are subcommands, while others are utility methods, but not all subcommands are behaving equally.argparse
is the correct alternative.Code quality
ipython_gpt.py
from module to a packageblack
Feature improvements
stream=True
.