Repository navigation
【bug】
#74
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I noticed a small issue in your ChatGPT_API_with_finish_reason function. In the exception handler, when max_retries is reached, the function returns only one value ("Error"), but in the success case it returns a tuple: (content, finish_reason). This inconsistency can cause a "not enough values to unpack" error when someone tries to unpack the return value (e.g., response, status = ChatGPT_API_with_finish_reason(...)).
It would be better to return a consistent number of values in all code paths—perhaps something like return "Error", "error" or raise an exception instead.
Thanks for sharing your code!
All reactions