Skip to content

Commit

Permalink
chore(client): use correct accept headers for binary data (#1161)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Feb 17, 2024
1 parent 7fe8ec3 commit e536437
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/openai/resources/audio/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
return self._post(
"/audio/speech",
body=maybe_transform(
Expand Down Expand Up @@ -149,6 +150,7 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
return await self._post(
"/audio/speech",
body=maybe_transform(
Expand Down
4 changes: 2 additions & 2 deletions src/openai/resources/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ def content(
"""
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
extra_headers = {"Accept": "application/binary", **(extra_headers or {})}
return self._get(
f"/files/{file_id}/content",
options=make_request_options(
Expand Down Expand Up @@ -272,7 +273,6 @@ def retrieve_content(
"""
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
extra_headers = {"Accept": "application/json", **(extra_headers or {})}
return self._get(
f"/files/{file_id}/content",
options=make_request_options(
Expand Down Expand Up @@ -511,6 +511,7 @@ async def content(
"""
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
extra_headers = {"Accept": "application/binary", **(extra_headers or {})}
return await self._get(
f"/files/{file_id}/content",
options=make_request_options(
Expand Down Expand Up @@ -545,7 +546,6 @@ async def retrieve_content(
"""
if not file_id:
raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}")
extra_headers = {"Accept": "application/json", **(extra_headers or {})}
return await self._get(
f"/files/{file_id}/content",
options=make_request_options(
Expand Down

0 comments on commit e536437

Please sign in to comment.