summaryrefslogtreecommitdiffhomepage
path: root/app/schemas.py
blob: 27ab96f26a078ccec6aa95ecfe49c0b7a39edd43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from typing import Literal

from pydantic import BaseModel


class TranscriptSegment(BaseModel):
    text: str
    start: float
    duration: float


class TranscriptResultResponse(BaseModel):
    status: Literal["completed"] = "completed"
    video_id: str
    full_text: str
    segments: list[TranscriptSegment]


class TranscriptQueuedResponse(BaseModel):
    status: Literal["queued", "processing"]
    video_id: str
    position: int
    estimated_seconds: float


class TranscriptFailedResponse(BaseModel):
    status: Literal["failed"] = "failed"
    video_id: str
    error: str
    error_type: str


TranscriptResponse = (
    TranscriptResultResponse | TranscriptQueuedResponse | TranscriptFailedResponse
)