Merge pull request #3928 from BerriAI/litellm_audio_speech_endpoint

feat(main.py): support openai tts endpoint
This commit is contained in:
Krish Dholakia 2024-05-30 17:30:42 -07:00 committed by GitHub
commit d3a247bf20
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 574 additions and 7 deletions

View file

@ -1136,6 +1136,8 @@ class CallTypes(Enum):
amoderation = "amoderation"
atranscription = "atranscription"
transcription = "transcription"
aspeech = "aspeech"
speech = "speech"
# Logging function -> log the exact model details + what's being sent | Non-BlockingP
@ -3005,6 +3007,10 @@ def function_setup(
):
_file_name: BinaryIO = args[1] if len(args) > 1 else kwargs["file"]
messages = "audio_file"
elif (
call_type == CallTypes.aspeech.value or call_type == CallTypes.speech.value
):
messages = kwargs.get("input", "speech")
stream = True if "stream" in kwargs and kwargs["stream"] == True else False
logging_obj = Logging(
model=model,
@ -3346,6 +3352,8 @@ def client(original_function):
return result
elif "atranscription" in kwargs and kwargs["atranscription"] == True:
return result
elif "aspeech" in kwargs and kwargs["aspeech"] == True:
return result
### POST-CALL RULES ###
post_call_processing(original_response=result, model=model or None)