Skip to content

Commit 9b5f8db

Browse files
authored
fix:fix response format bug (#282)
* 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
1 parent fad5a24 commit 9b5f8db

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

openai/api_requestor.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,10 @@ def _interpret_response_line(
666666
headers=rheaders,
667667
)
668668
try:
669-
data = json.loads(rbody)
669+
if 'text/plain' in rheaders.get('Content-Type'):
670+
data = rbody
671+
else:
672+
data = json.loads(rbody)
670673
except (JSONDecodeError, UnicodeDecodeError) as e:
671674
raise error.APIError(
672675
f"HTTP code {rcode} from API ({rbody})", rbody, rcode, headers=rheaders

0 commit comments

Comments
 (0)