zeno-ml / zeno-build

Build, evaluate, understand, and fix LLM-based apps
MIT License
482 stars 33 forks source link

Refactor `chat_generate` #171

Closed zhaochenyang20 closed 1 year ago

zhaochenyang20 commented 1 year ago

Description

  1. I create ERROR_ERRORS_TO_MESSAGES to make the error handling clearer for _throttled_openai_completion_acreate and _throttled_openai_chat_completion_acreate.
  2. There is no TimeoutError in openai.error, so I delete it.
  3. I add a new parameter n for both completion, which is the number of responses to generate for each API call.

References

Blocked by

zhaochenyang20 commented 1 year ago

Hey @neubig and @cabreraalex, sorry for creating this one and discarding the previous PR. I failed several times for the pre-commit of #170, then I uninstall all the environments for my local Python 3.11.3, use 3.9.17, delete the previous fork, and create a new one. It seems to work out. 🤔

The way to fix this is really strange. Delete, re-install, and re-run them all. 😂 I spent a long time searching for help from StackOverflow and so on...

zhaochenyang20 commented 1 year ago

Thanks so much for your help and advise for this PR and issue #169!

zhaochenyang20 commented 1 year ago

Thanks @zhaochenyang20 , this looks great! There is just one small change request. I used Github's suggestion functionality, so you should just be able to click "accept suggestion".

And sorry about the trouble with the isort stuff, I'm not sure what was causing that

Done! The other part is just fine. I don't know what causes this strange behavior of isort either. 🤷🏻‍♀️

neubig commented 1 year ago

Great, merged. Thanks for the contribution!