Skip to content

Commit d586ddc

Browse files
authored
[BugFix] Fix authorization of openai_transcription_client.py (#17321)
Signed-off-by: zh Wang <[email protected]>
1 parent 0b7e701 commit d586ddc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

examples/online_serving/openai_transcription_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ async def stream_openai_response():
4646
"model": "openai/whisper-large-v3",
4747
}
4848
url = openai_api_base + "/audio/transcriptions"
49+
headers = {"Authorization": f"Bearer {openai_api_key}"}
4950
print("transcription result:", end=' ')
5051
async with httpx.AsyncClient() as client:
5152
with open(str(winning_call), "rb") as f:
52-
async with client.stream('POST', url, files={'file': f},
53-
data=data) as response:
53+
async with client.stream('POST',
54+
url,
55+
files={'file': f},
56+
data=data,
57+
headers=headers) as response:
5458
async for line in response.aiter_lines():
5559
# Each line is a JSON object prefixed with 'data: '
5660
if line:

0 commit comments

Comments
 (0)