Implement support for segments with an optional categories key
This commit is contained in:
@@ -25,3 +25,19 @@ def test_chunk_transcript_batches_sections_by_token_limit():
|
||||
assert len(sections) == 2
|
||||
assert [segment.segment.id for segment in sections[0].segments] == [1, 2]
|
||||
assert [segment.segment.id for segment in sections[1].segments] == [3]
|
||||
|
||||
|
||||
def test_chunk_transcript_prompt_payload_includes_categories_when_present():
|
||||
transcript = parse_transcript_json(
|
||||
"""
|
||||
[
|
||||
{"id": 1, "speaker": "A", "start": 0.0, "end": 1.0, "text": "one", "categories": ["intro", "aside"]}
|
||||
]
|
||||
"""
|
||||
)
|
||||
|
||||
sections = chunk_transcript(transcript, max_section_tokens=8, estimator=FakeEstimator())
|
||||
|
||||
assert sections[0].prompt_payload() == [
|
||||
{"id": 1, "original_text": "one", "categories": ["intro", "aside"]}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user