Skip to content

Check if response has a choice before debug logging to prevent null r… #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2024

Conversation

darkthread
Copy link
Contributor

The debug logging will cause an exception when the response contains no choice. Adding check logic before using response.Choices[0] can prevent errors.

@cjellick
Copy link
Contributor

cjellick commented Mar 5, 2024

Do you have a usecase that reproduces?

Co-authored-by: Nick Hale <[email protected]>
Signed-off-by: Jeffrey Lee <[email protected]>
Copy link
Member

@njhale njhale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@njhale njhale requested review from thedadams and tylerslaton March 6, 2024 17:34
@njhale njhale linked an issue Mar 6, 2024 that may be closed by this pull request
Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution @darkthread 👍🏻

@njhale njhale merged commit a3cbe20 into gptscript-ai:main Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

debug message caused program to panic on any gptscript
4 participants