Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/speaches/executors/shared/handler_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TranscriptionRequest(BaseModel):
language: str | None = None
prompt: str | None = None
response_format: openai.types.AudioResponseFormat = "json"
temperature: float = 0.0
temperature: float | list[float] = 0.0
hotwords: str | None = None
timestamp_granularities: TimestampGranularities
speech_segments: list[SpeechTimestamp]
Expand Down Expand Up @@ -103,7 +103,7 @@ class TranslationRequest(BaseModel):
model: str
prompt: str | None = None
response_format: openai.types.AudioResponseFormat = "json"
temperature: float = 0.0
temperature: float | list[float] = 0.0
speech_segments: list[SpeechTimestamp]
vad_options: VadOptions

Expand Down
8 changes: 4 additions & 4 deletions src/speaches/routers/stt.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def translate_file(
model: Annotated[ModelId, Form()],
prompt: Annotated[str | None, Form()] = None,
response_format: Annotated[ResponseFormat, Form()] = DEFAULT_RESPONSE_FORMAT,
temperature: Annotated[float, Form()] = 0.0,
temperature: Annotated[float | list[float], Form()] = 0.0,
) -> Response:
model_card_data = get_model_card_data_or_raise(model)
executor = find_executor_for_model_or_raise(model, model_card_data, executor_registry.translation)
Expand All @@ -79,7 +79,7 @@ def translate_file(
model=model,
prompt=prompt,
response_format=response_format,
temperature=temperature,
temperature=temperature if temperature != 0.0 else [0.0, 0.2, 0.4, 0.6, 0.8, 1.0],
speech_segments=speech_segments,
vad_options=DEFAULT_VAD_OPTIONS,
)
Expand Down Expand Up @@ -129,7 +129,7 @@ def transcribe_file(
language: Annotated[str | None, Form()] = None,
prompt: Annotated[str | None, Form()] = None,
response_format: Annotated[ResponseFormat, Form()] = DEFAULT_RESPONSE_FORMAT,
temperature: Annotated[float, Form()] = 0.0,
temperature: Annotated[float | list[float], Form()] = 0.0,
timestamp_granularities: Annotated[
TimestampGranularities,
# WARN: `alias` doesn't actually work.
Expand Down Expand Up @@ -160,7 +160,7 @@ def transcribe_file(
language=language,
prompt=prompt,
response_format=response_format,
temperature=temperature,
temperature=temperature if temperature != 0.0 else [0.0, 0.2, 0.4, 0.6, 0.8, 1.0],
timestamp_granularities=timestamp_granularities,
stream=stream,
hotwords=hotwords,
Expand Down