Skip to content
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

BrokenSchemaError #3

Closed
leoplusx opened this issue Sep 4, 2023 · 1 comment
Closed

BrokenSchemaError #3

leoplusx opened this issue Sep 4, 2023 · 1 comment

Comments

@leoplusx
Copy link

leoplusx commented Sep 4, 2023

If I get a BrokenSchemaError, is there any way I can inspect both the prompt that was sent to OpenAI and the raw output we got from the model? Thanks.

@rizerphe
Copy link
Owner

rizerphe commented Sep 5, 2023

Thank you for your question! Yes, there is a way. The BrokenSchemaError object contains both of them as properties, so here's how you'd extract them:

try:
    ...
except BrokenSchemaError as error:
    schema = error.schema
    openai_response = schema.response # As a JSON object

Similarly, you can extract the raw string response from an InvalidJsonError with error.response.

@rizerphe rizerphe closed this as completed Sep 5, 2023
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

No branches or pull requests

2 participants