11from __future__ import annotations
22
33import logging
4- from typing import TYPE_CHECKING , Mapping , Optional , cast
4+ from typing import TYPE_CHECKING , List , Mapping , Optional , cast
55
66import httpx
77from typing_extensions import Literal
@@ -43,10 +43,12 @@ def create(
4343 * ,
4444 file : FileTypes ,
4545 model : str ,
46+ file_base64 : Optional [str ] | NotGiven = NOT_GIVEN ,
47+ prompt : Optional [str ] | NotGiven = NOT_GIVEN ,
48+ hotwords : Optional [List [str ]] | NotGiven = NOT_GIVEN ,
4649 request_id : Optional [str ] | NotGiven = NOT_GIVEN ,
4750 user_id : Optional [str ] | NotGiven = NOT_GIVEN ,
4851 stream : Optional [Literal [False ]] | Literal [True ] | NotGiven = NOT_GIVEN ,
49- temperature : Optional [float ] | NotGiven = NOT_GIVEN ,
5052 sensitive_word_check : Optional [SensitiveWordCheckRequest ] | NotGiven = NOT_GIVEN ,
5153 extra_headers : Headers | None = None ,
5254 extra_body : Body | None = None ,
@@ -58,28 +60,26 @@ def create(
5860 Arguments:
5961 file (FileTypes): Audio file to transcribe
6062 model (str): The model to use for transcription
63+ file_base64 (Optional[str]): Base64 encoded audio file (alternative to file)
64+ prompt (Optional[str]): Previous transcription result for context
65+ hotwords (Optional[List[str]]): Hot words to improve recognition rate
6166 request_id (Optional[str]): Unique identifier for the request
6267 user_id (Optional[str]): User identifier
6368 stream (Optional[Literal[False]] | Literal[True]): Whether to stream the response
64- temperature (Optional[float]): Sampling temperature for transcription
6569 sensitive_word_check (Optional[SensitiveWordCheckRequest]): Sensitive word check configuration
6670 extra_headers (Headers): Additional headers to send
6771 extra_body (Body): Additional body parameters
6872 timeout (float | httpx.Timeout): Request timeout
6973 """
70- if temperature is not None and temperature != NOT_GIVEN :
71- if temperature <= 0 :
72- temperature = 0.01
73- if temperature >= 1 :
74- temperature = 0.99
75-
7674 body = deepcopy_minimal (
7775 {
7876 'model' : model ,
7977 'file' : file ,
78+ 'file_base64' : file_base64 ,
79+ 'prompt' : prompt ,
80+ 'hotwords' : hotwords ,
8081 'request_id' : request_id ,
8182 'user_id' : user_id ,
82- 'temperature' : temperature ,
8383 'sensitive_word_check' : sensitive_word_check ,
8484 'stream' : stream ,
8585 }
0 commit comments