amanyelfiky's picture
s2
e6a0493
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']."
),
)