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

APIErrorResponse message can be [String]. Handle it. #95

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

fabstu
Copy link
Contributor

@fabstu fabstu commented Aug 2, 2023

What

The API error response message can be an array. Decode that to a String.

Why

API errors where the response is [String] like for ChatGPT -> Functions misuse is not decoded and shown.

Affected Areas

Error handling.
Not sure about streaming errors.

Before:

Manually inserting print into the library to find what the error message is in the first place. Should probably add the print when we fail to decode the error so the next person does not have to add the print to debug?

Failed to decode request: Optional("{\n "error": {\n "message": [\n "Invalid schema for function 'hello': In context=('properties', 'a'), array schema missing items"\n ],\n "type": "invalid_request_error",\n "param": null,\n "code": null\n }\n}\n")

After:

OpenAI.APIErrorResponse(error: OpenAI.APIError(message: "Invalid schema for function 'hello': In context=('properties', 'a'), array schema missing items", type: "invalid_request_error", param: nil, code: nil))

@sonarcloud
Copy link

sonarcloud bot commented Aug 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Krivoblotsky Krivoblotsky merged commit ac66006 into MacPaw:main Aug 22, 2023
5 checks passed
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.

2 participants