File size: 1,682 Bytes
851e5ba | 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 | from src.ai import TranscriptAnalysis
def test_transcript_segment_accepts_minimal_local_llm_shape():
analysis = TranscriptAnalysis.model_validate(
{
"most_relevant_segments": [
{
"start_time": "00:00",
"end_time": "00:15",
"segment": "This is a standalone clip candidate from a local model.",
}
],
"summary": "A short summary.",
"key_topics": ["local model output"],
}
)
segment = analysis.most_relevant_segments[0]
assert segment.text == "This is a standalone clip candidate from a local model."
assert segment.relevance_score == 0.75
assert segment.reasoning == "Selected by the AI model as a clip candidate."
assert segment.virality.total_score == 60
def test_transcript_analysis_ignores_legacy_broll_opportunities():
# Older prompts and cached analyses still carry this key; clip B-roll is
# now planned per rendered clip, so it must not break validation.
analysis = TranscriptAnalysis.model_validate(
{
"most_relevant_segments": [
{
"start_time": "00:00",
"end_time": "00:15",
"text": "This clip has enough words to pass the text validation.",
}
],
"summary": "A short summary.",
"key_topics": ["local model output"],
"broll_opportunities": [{"broll": ["programming tutorial channels"]}],
}
)
assert len(analysis.most_relevant_segments) == 1
assert not hasattr(analysis, "broll_opportunities")
|