Ad Ryan
12/06/2024, 4:55 PM@bentoml.api(route="/v1/audio/transcriptions")
def transcribe(
self,
file: Annotated[Path, ContentType("audio/mpeg")],
model: Optional[ModelName] = Field(),
language: Optional[Language] = Field(),
prompt: Optional[float] = Field(),
response_format: Optional[ResponseFormat] = Field(),
temperature: Optional[Union[float, List[float]]] = Field(),
timestamp_granularities: Optional[List[TimestampGranularity]] = Field()
)
Now, because the file is sent together with all the other parameters, the request generated by the Swagger UI is of Content-Type: multipart/form-data. So far so good, what does not work is to send a list of timestamp_granularities or a list of temperature from the Swagger UI because the list is passed as comma-separated-values (word,segment).
curl -X 'POST' \
'<http://localhost:8002/v1/audio/transcriptions>' \
-H 'accept: text/plain' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@example_audio.mp3;type=audio/mpeg' \
-F 'timestamp_granularities=word,segment'
Is there either a way to pass a list instead of comma-separated-values or alternatively access the request-context and split the csv up myself?
Thanks a lot in advance!!Jian Shen Yap
12/18/2024, 2:26 AM