Skip to content

Commit 2db1d58

Browse files
Fedir Zadniprovskyifedirz
authored andcommitted
chore: add miscellaneous comments
1 parent 829d87b commit 2db1d58

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/speaches/api_types.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@ def offset(self, seconds: float) -> None:
3333

3434
# https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L10938
3535
class TranscriptionSegment(BaseModel):
36+
avg_logprob: float
37+
compression_ratio: float
38+
end: float
3639
id: int
40+
no_speech_prob: float
3741
seek: int
3842
start: float
39-
end: float
43+
temperature: float
4044
text: str
4145
tokens: list[int]
42-
temperature: float
43-
avg_logprob: float
44-
compression_ratio: float
45-
no_speech_prob: float
46-
words: list[TranscriptionWord] | None
46+
words: (
47+
list[TranscriptionWord] | None
48+
) # TODO: why is here? It's not a field defined in the [OpenAI API spec](https://platform.openai.com/docs/api-reference/audio/verbose-json-object)
49+
# TODO: add `usage` field: https://platform.openai.com/docs/api-reference/audio/verbose-json-object#audio/verbose-json-object-usage
4750

4851
@classmethod
4952
def from_faster_whisper_segments(
@@ -79,6 +82,8 @@ def from_faster_whisper_segments(
7982
# https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L10924
8083
class CreateTranscriptionResponseJson(BaseModel):
8184
text: str
85+
# NOTE: there's also a `logprobs` field it's only supported by non-whisper models, so we don't include it here (we can't `faster-whisper` doesn't provide it)
86+
# TODO: add `usage` field: https://platform.openai.com/docs/api-reference/audio/json-object#audio/json-object-usage
8287

8388
@classmethod
8489
def from_segments(cls, segments: list[TranscriptionSegment]) -> "CreateTranscriptionResponseJson":
@@ -88,6 +93,7 @@ def from_segments(cls, segments: list[TranscriptionSegment]) -> "CreateTranscrip
8893
# https://platform.openai.com/docs/api-reference/audio/verbose-json-object
8994
# https://github.com/openai/openai-openapi/blob/master/openapi.yaml#L11007
9095
class CreateTranscriptionResponseVerboseJson(BaseModel):
96+
# NOTE: there's also a `logprobs` field it's only supported by non-whisper models, so we don't include it here (we can't `faster-whisper` doesn't provide it)
9197
task: str = "transcribe"
9298
language: str
9399
duration: float

0 commit comments

Comments
 (0)