File size: 1,342 Bytes
74cf6bd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ad6b1b
 
74cf6bd
 
 
 
 
 
 
 
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
from pydantic import BaseModel, Field
from typing import Optional


class VideoSegment(BaseModel):
    """Model for a video segment with transcript."""

    text: str = Field(..., description="Transcript text of the segment")
    start: float = Field(..., description="Start time in seconds")
    end: float = Field(..., description="End time in seconds")
    segment_id: str = Field(..., description="Unique identifier for the segment")
    video_id: str = Field(..., description="YouTube video ID this segment belongs to")


class Video(BaseModel):
    """Model for a YouTube video with metadata."""

    video_id: str = Field(..., description="YouTube video ID")
    title: Optional[str] = Field(None, description="Video title")
    description: Optional[str] = Field(None, description="Video description")
    channel: Optional[str] = Field(None, description="Channel name")
    processed: bool = Field(False, description="Whether the video has been processed")
    created_at: Optional[int] = Field(
        None,
        description="Unix timestamp (seconds since epoch) when the video was processed",
    )


class SearchResult(BaseModel):
    """Model for a video segment search result."""

    score: float = Field(..., description="Similarity score")
    segment: VideoSegment = Field(..., description="The matching video segment")