Skip to content

Commit

Permalink
fix:fix response format bug (#282)
Browse files Browse the repository at this point in the history
* fix:fix bug

* fix:fix response_format bug

* fix:fix response_format bug

* fix:fix response_format bug

* fix:fix response_format bug

* fix:fix response_format bug

* fix:fix response_format bug

* fix:fix response_format bug
  • Loading branch information
guaguaguaxia authored Mar 8, 2023
1 parent fad5a24 commit 9b5f8db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion openai/api_requestor.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,10 @@ def _interpret_response_line(
headers=rheaders,
)
try:
data = json.loads(rbody)
if 'text/plain' in rheaders.get('Content-Type'):
data = rbody
else:
data = json.loads(rbody)
except (JSONDecodeError, UnicodeDecodeError) as e:
raise error.APIError(
f"HTTP code {rcode} from API ({rbody})", rbody, rcode, headers=rheaders
Expand Down

0 comments on commit 9b5f8db

Please sign in to comment.