Skip to content

Conversation

@guaguaguaxia
Copy link
Contributor

fix this issue:#243

Comment on lines 670 to 673

Choose a reason for hiding this comment

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

I checked and the Content-Type header on the response is always set correctly (at least for the audio transcription responses), so we can deduce whether to json-decode without any other code changes.
For the json and verbose_json response formats, the Content-Type is 'application/json', while for text, srt, and vtt, the Content-Type is 'text/plain; charset=utf-8'`.

Suggested change
if self.response_format == ResponseFormat.JSON:
data = json.loads(rbody)
else:
data = rbody
if rheaders.get('Content-Type') == 'application/json':
data = json.loads(rbody)
else:
data = rbody

@guaguaguaxia
Copy link
Contributor Author

@MattFisher please review in #282, i don't know how i close this PR 😭

@guaguaguaxia
Copy link
Contributor Author

@MattFisher because i force rollback my code so github close this PR automatically,so please review in #282

@guaguaguaxia
Copy link
Contributor Author

@logankilpatrick @mpokrass

stainless-app bot pushed a commit that referenced this pull request Mar 27, 2025
…-changes--next--components--openai

chore(next => master): release 4.5.0
safa0 pushed a commit to safa0/openai-agents-python that referenced this pull request Apr 27, 2025
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