File size: 2,065 Bytes
e6a0493
d74863e
 
dc249d2
3c66ec8
dc249d2
 
3c66ec8
dc249d2
3c66ec8
dc249d2
3c66ec8
dc249d2
3c66ec8
dc249d2
3c66ec8
 
 
 
 
dc249d2
d74863e
bacc801
e6a0493
3c66ec8
dc249d2
 
3c66ec8
e6a0493
dc249d2
 
 
 
 
 
 
 
 
3c66ec8
 
dc249d2
 
 
 
e6a0493
 
 
 
 
 
 
 
 
 
3c66ec8
dc249d2
 
3c66ec8
e6a0493
3c66ec8
 
 
 
 
dc249d2
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from typing import Annotated, List, Optional
from pydantic import BaseModel, Field

class SegmentSchema(BaseModel):
    """Represents one chronological section of the video timeline."""
    title: str = Field(
        ...,
        description="A short, descriptive title for this chronological segment.",
    )
    summary: str = Field(
        ...,
        description="A concise summary of what is covered in this segment (2-3 sentences).",
    )
    key_insight: str = Field(
        ...,
        description="The single most important point or takeaway from this segment.",
    )
    why_it_matters: str = Field(
        ...,
        description="Brief explanation of the value or importance of this segment (1-2 sentences).",
    )

class SummarySchema(BaseModel):
    """Primary Summary response schema."""
    summary: str = Field(
        ...,
        description=(
            "A concise, high-level paragraph (3-5 sentences) that explains"
            " what the entire video is about, its main thesis, and its value."
        ),
    )

    segments: Annotated[
        List[SegmentSchema],
        Field(
            min_length=3,
            max_length=7,
            description=(
                "Chronological timeline sections of the video. Minimum 3,"
                " maximum 7. Must follow the natural progression of the transcript."
            ),
        ),
    ]

    suggested_category: str = Field(
        default="General",
        description=(
            "A single, concise category label (1-2 words max) that best"
            " describes the video content. Must always be in English."
        ),
    )

    conclusion: Optional[str] = Field(
        default=None,
        description="A final overall takeaway or closing conclusion in the transcript language.",
    )

    topics: List[str] = Field(
        default_factory=list,
        min_length=1,
        description=(
            "Dynamically extracted topics discussed in the video."
            " Examples: ['Python', 'Machine Learning', 'Neural Networks']."
        ),
    )