Skip to content

Commit

Permalink
Merge branch 'BerriAI:main' into feature/watsonx-integration
Browse files Browse the repository at this point in the history
  • Loading branch information
simonsanvil committed Apr 20, 2024
2 parents 7b2bd2e + 0dc7f02 commit c36cb7d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4166,6 +4166,14 @@ async def audio_transcriptions(
file.filename is not None
) # make sure filename passed in (needed for type)

_original_filename = file.filename
file_extension = os.path.splitext(file.filename)[1]
# rename the file to a random hash file name -> we eventuall remove the file and don't want to remove any local files
file.filename = f"tmp-request" + str(uuid.uuid4()) + file_extension

# IMP - Asserts that we've renamed the uploaded file, since we run os.remove(file.filename), we should rename the original file
assert file.filename != _original_filename

with open(file.filename, "wb+") as f:
f.write(await file.read())
try:
Expand Down

0 comments on commit c36cb7d

Please sign in to comment.