forked from phoenix/litellm-mirror
(feat): Add timestamp_granularities parameter to transcription API (#6457)
* Add timestamp_granularities parameter to transcription API * add param to the local test
This commit is contained in:
parent
f4ec93fbc3
commit
e89dcccdd9
3 changed files with 6 additions and 1 deletions
|
@ -4729,6 +4729,7 @@ def transcription(
|
||||||
response_format: Optional[
|
response_format: Optional[
|
||||||
Literal["json", "text", "srt", "verbose_json", "vtt"]
|
Literal["json", "text", "srt", "verbose_json", "vtt"]
|
||||||
] = None,
|
] = None,
|
||||||
|
timestamp_granularities: List[Literal["word", "segment"]] = None,
|
||||||
temperature: Optional[int] = None, # openai defaults this to 0
|
temperature: Optional[int] = None, # openai defaults this to 0
|
||||||
## LITELLM PARAMS ##
|
## LITELLM PARAMS ##
|
||||||
user: Optional[str] = None,
|
user: Optional[str] = None,
|
||||||
|
@ -4778,6 +4779,7 @@ def transcription(
|
||||||
language=language,
|
language=language,
|
||||||
prompt=prompt,
|
prompt=prompt,
|
||||||
response_format=response_format,
|
response_format=response_format,
|
||||||
|
timestamp_granularities=timestamp_granularities,
|
||||||
temperature=temperature,
|
temperature=temperature,
|
||||||
custom_llm_provider=custom_llm_provider,
|
custom_llm_provider=custom_llm_provider,
|
||||||
drop_params=drop_params,
|
drop_params=drop_params,
|
||||||
|
|
|
@ -2125,6 +2125,7 @@ def get_optional_params_transcription(
|
||||||
prompt: Optional[str] = None,
|
prompt: Optional[str] = None,
|
||||||
response_format: Optional[str] = None,
|
response_format: Optional[str] = None,
|
||||||
temperature: Optional[int] = None,
|
temperature: Optional[int] = None,
|
||||||
|
timestamp_granularities: Optional[List[Literal["word", "segment"]]] = None,
|
||||||
custom_llm_provider: Optional[str] = None,
|
custom_llm_provider: Optional[str] = None,
|
||||||
drop_params: Optional[bool] = None,
|
drop_params: Optional[bool] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
|
|
|
@ -53,8 +53,9 @@ from litellm import Router
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize("response_format", ["json", "vtt"])
|
@pytest.mark.parametrize("response_format", ["json", "vtt"])
|
||||||
@pytest.mark.parametrize("sync_mode", [True, False])
|
@pytest.mark.parametrize("sync_mode", [True, False])
|
||||||
|
@pytest.mark.parametrize("timestamp_granularities", [["word"], ["segment"]])
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_transcription(model, api_key, api_base, response_format, sync_mode):
|
async def test_transcription(model, api_key, api_base, response_format, sync_mode, timestamp_granularities):
|
||||||
if sync_mode:
|
if sync_mode:
|
||||||
transcript = litellm.transcription(
|
transcript = litellm.transcription(
|
||||||
model=model,
|
model=model,
|
||||||
|
@ -62,6 +63,7 @@ async def test_transcription(model, api_key, api_base, response_format, sync_mod
|
||||||
api_key=api_key,
|
api_key=api_key,
|
||||||
api_base=api_base,
|
api_base=api_base,
|
||||||
response_format=response_format,
|
response_format=response_format,
|
||||||
|
timestamp_granularities=timestamp_granularities,
|
||||||
drop_params=True,
|
drop_params=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue