fix: enforce meeting summary sections
This commit is contained in:
+38
-11
@@ -311,14 +311,27 @@ async def _chat_completion(prompt: str, *, timeout: int = 180) -> str:
|
|||||||
|
|
||||||
|
|
||||||
def _summary_prompt(transcript: str) -> str:
|
def _summary_prompt(transcript: str) -> str:
|
||||||
return f"""You are a meeting summarizer. Given the following meeting transcript, produce a concise, well-structured summary with:
|
return f"""You are a meeting summarizer. Given the following meeting transcript, produce a concise, well-structured summary.
|
||||||
|
|
||||||
1. **Overview** — 2-3 sentences covering what was discussed
|
Use exactly these markdown section headings, in this order:
|
||||||
2. **Key Decisions** — decisions that were made
|
|
||||||
3. **Action Items** — who needs to do what (use bullet points)
|
|
||||||
4. **Next Steps / Deadlines** — any dates, timelines, or follow-ups mentioned
|
|
||||||
|
|
||||||
If speaker labels are present, preserve them where helpful in action items.
|
## What Was Done
|
||||||
|
- Summarize the work completed, progress reported, and status updates.
|
||||||
|
- Include all dev team members' reports that appear in the transcript; do not omit any named person.
|
||||||
|
|
||||||
|
## What Will Be Done Next
|
||||||
|
- Summarize the upcoming work, planned follow-ups, and expected next steps.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
- Use bullet points.
|
||||||
|
- For each item, include the owner when it is mentioned.
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
- List decisions that were made.
|
||||||
|
- If no decisions were made, say "- None recorded."
|
||||||
|
|
||||||
|
If speaker labels are present, preserve them where helpful.
|
||||||
|
Do not add extra top-level sections.
|
||||||
|
|
||||||
Transcript:
|
Transcript:
|
||||||
{transcript}"""
|
{transcript}"""
|
||||||
@@ -341,12 +354,26 @@ def _combined_summary_prompt(chunk_summaries: list[str]) -> str:
|
|||||||
merged = "\n\n".join(
|
merged = "\n\n".join(
|
||||||
f"Chunk {index}:\n{summary}" for index, summary in enumerate(chunk_summaries, start=1)
|
f"Chunk {index}:\n{summary}" for index, summary in enumerate(chunk_summaries, start=1)
|
||||||
)
|
)
|
||||||
return f"""You are a meeting summarizer. The transcript was summarized in chunks first. Combine them into one final meeting summary with:
|
return f"""You are a meeting summarizer. The transcript was summarized in chunks first. Combine them into one final meeting summary.
|
||||||
|
|
||||||
1. **Overview** — 2-3 sentences covering what was discussed
|
Use exactly these markdown section headings, in this order:
|
||||||
2. **Key Decisions** — decisions that were made
|
|
||||||
3. **Action Items** — who needs to do what (use bullet points)
|
## What Was Done
|
||||||
4. **Next Steps / Deadlines** — any dates, timelines, or follow-ups mentioned
|
- Summarize the work completed, progress reported, and status updates.
|
||||||
|
- Include all dev team members' reports that appear in the chunk summaries; do not omit any named person.
|
||||||
|
|
||||||
|
## What Will Be Done Next
|
||||||
|
- Summarize the upcoming work, planned follow-ups, and expected next steps.
|
||||||
|
|
||||||
|
## Action Items
|
||||||
|
- Use bullet points.
|
||||||
|
- For each item, include the owner when it is mentioned.
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
- List decisions that were made.
|
||||||
|
- If no decisions were made, say "- None recorded."
|
||||||
|
|
||||||
|
Do not add extra top-level sections.
|
||||||
|
|
||||||
Combined chunk summaries:
|
Combined chunk summaries:
|
||||||
{merged}"""
|
{merged}"""
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ from openrouter_client import (
|
|||||||
_audio_format,
|
_audio_format,
|
||||||
_build_transcription_payload,
|
_build_transcription_payload,
|
||||||
_chunk_text,
|
_chunk_text,
|
||||||
|
_combined_summary_prompt,
|
||||||
|
_summary_prompt,
|
||||||
summarize,
|
summarize,
|
||||||
transcribe,
|
transcribe,
|
||||||
)
|
)
|
||||||
@@ -114,3 +116,23 @@ def test_summarize_uses_multi_stage_pipeline_for_long_transcript(monkeypatch, ca
|
|||||||
assert any("Partial meeting transcript chunk" in prompt for prompt in prompts[:-1])
|
assert any("Partial meeting transcript chunk" in prompt for prompt in prompts[:-1])
|
||||||
assert "Combined chunk summaries" in prompts[-1]
|
assert "Combined chunk summaries" in prompts[-1]
|
||||||
assert "Transcript exceeds single-pass summary limit" in caplog.text
|
assert "Transcript exceeds single-pass summary limit" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
|
def test_summary_prompt_requires_requested_sections():
|
||||||
|
prompt = _summary_prompt("Alice: finished API work")
|
||||||
|
|
||||||
|
assert "## What Was Done" in prompt
|
||||||
|
assert "## What Will Be Done Next" in prompt
|
||||||
|
assert "## Action Items" in prompt
|
||||||
|
assert "## Decisions" in prompt
|
||||||
|
assert "all dev team members' reports" in prompt
|
||||||
|
|
||||||
|
|
||||||
|
def test_combined_summary_prompt_requires_requested_sections():
|
||||||
|
prompt = _combined_summary_prompt(["Chunk 1 summary", "Chunk 2 summary"])
|
||||||
|
|
||||||
|
assert "## What Was Done" in prompt
|
||||||
|
assert "## What Will Be Done Next" in prompt
|
||||||
|
assert "## Action Items" in prompt
|
||||||
|
assert "## Decisions" in prompt
|
||||||
|
assert "all dev team members' reports" in prompt
|
||||||
|
|||||||
Reference in New Issue
Block a user