Building a Meeting Transcription Workflow

Ma Mahalakshmi V Updated 16 Sep 2026
8 min read ·Lesson 110 of 224

From a Single API Call to a Real Pipeline

Everything covered so far in this unit — transcribing a file, handling uploads, extracting timestamps — are the individual components of a larger system. This lesson assembles them into something closer to a real application: an end-to-end workflow that takes a recorded meeting and produces a structured, useful artifact — a transcript with timestamps, speaker-oriented sections, and a concise summary — rather than just a wall of raw text.

A meeting transcription workflow needs to handle several concerns that a single transcription call does not address on its own: meetings are often long (potentially exceeding single-request audio limits, which Lesson 8 covers in depth), they benefit from structural organization (who said what, roughly, even without true speaker diarization), and raw transcripts are rarely the actual deliverable — most people want a summary and action items, not a full verbatim dump. Building this workflow means combining the transcription endpoint with a chat completion call that processes the transcript afterward.

Step 1: Transcribing with Segment Metadata

The workflow begins with transcription using segment-level timestamps, since a meeting transcript is far more useful when readers can jump to specific moments:

from openai import OpenAI

client = OpenAI()


def transcribe_meeting(audio_path: str):
    with open(audio_path, "rb") as audio_file:
        transcript = client.audio.transcriptions.create(
            model="gpt-5.6-terra",
            file=audio_file,
            response_format="verbose_json",
            timestamp_granularities=["segment"],
            prompt="This is a business meeting. Expect names, project names, and technical terms.",
        )
    return transcript

The prompt here is doing meaningful work, as explained in Lesson 2: meetings are full of proper nouns — project codenames, colleague names, internal tool names — that a general-purpose transcription model has no way to anticipate without a hint. A short, generic prompt like this one measurably reduces misspellings of names and jargon compared to no prompt at all.

Step 2: Formatting the Transcript into Readable Sections

Raw segments are typically short (a sentence or a partial sentence each), so displaying them one by one produces a choppy, hard-to-read wall of tiny timestamped fragments. Grouping nearby segments into readable paragraphs, while preserving a timestamp anchor for each group, produces a much more usable transcript:

def group_segments_into_paragraphs(segments, max_gap_seconds: float = 2.0, max_paragraph_seconds: float = 45.0):
    """
    Groups consecutive segments into paragraphs. A new paragraph starts when
    there is a pause longer than max_gap_seconds, or when the current
    paragraph would exceed max_paragraph_seconds in length.
    """
    paragraphs = []
    current_texts = []
    paragraph_start = None
    previous_end = None

    for segment in segments:
        if paragraph_start is None:
            paragraph_start = segment.start

        gap_too_large = previous_end is not None and (segment.start - previous_end) > max_gap_seconds
        paragraph_too_long = (segment.end - paragraph_start) > max_paragraph_seconds

        if gap_too_large or paragraph_too_long:
            paragraphs.append({
                "start": paragraph_start,
                "text": " ".join(current_texts).strip(),
            })
            current_texts = []
            paragraph_start = segment.start

        current_texts.append(segment.text.strip())
        previous_end = segment.end

    if current_texts:
        paragraphs.append({
            "start": paragraph_start,
            "text": " ".join(current_texts).strip(),
        })

    return paragraphs

This function walks through segments in order, accumulating their text into current_texts until one of two conditions triggers a new paragraph: either a long silence (gap_too_large, meaning more than max_gap_seconds passed between one segment ending and the next starting — often a real pause between topics or speakers) or the current paragraph growing too long (paragraph_too_long). When either condition is met, the accumulated text is joined into a single paragraph string, tagged with the timestamp of its first segment (paragraph_start), and the accumulator resets. The final if current_texts: block after the loop is essential — without it, whatever segments accumulated after the last paragraph break would be silently dropped, since the loop only flushes a paragraph when a new one starts, not automatically at the end.

This heuristic-based grouping is not true speaker diarization (identifying which of several speakers said what) — the transcription endpoint used here does not provide per-speaker labels. It approximates readable structure using pause timing alone, which works reasonably well for meetings with natural conversational pauses, but will not distinguish who is speaking. Applications that require true multi-speaker labeling need a separate diarization step or model, which is beyond the scope of what this endpoint provides.

Step 3: Summarizing the Transcript with a Chat Completion

Once you have a clean, paragraph-structured transcript, generating a summary and action items is a text-processing task, not an audio task — this is where the transcription pipeline hands off to a standard chat completion call:

def summarize_meeting_transcript(client, full_transcript_text: str) -> str:
    response = client.chat.completions.create(
        model="gpt-5.6-terra",
        messages=[
            {
                "role": "system",
                "content": (
                    "You summarize meeting transcripts. Produce a brief summary "
                    "paragraph followed by a bulleted list of action items with "
                    "the responsible person named when mentioned in the transcript."
                ),
            },
            {"role": "user", "content": full_transcript_text},
        ],
    )
    return response.choices[0].message.content

This step reuses the same client object already used for transcription, since both audio and chat endpoints live under the same OpenAI client instance — there is no need for a separate connection or authentication setup. The system message defines the exact output shape you want (a summary paragraph plus a bulleted action list), which is a form of prompt engineering covered more thoroughly elsewhere in this course; the key point for this lesson is that combining STT output with a subsequent chat completion call is what turns a raw transcript into a genuinely useful meeting artifact.

Assembling the Full Workflow

from openai import OpenAI

client = OpenAI()


def run_meeting_transcription_workflow(audio_path: str) -> dict:
    transcript = transcribe_meeting(audio_path)
    paragraphs = group_segments_into_paragraphs(transcript.segments)

    full_text = "\n\n".join(p["text"] for p in paragraphs)
    summary = summarize_meeting_transcript(client, full_text)

    return {
        "duration_seconds": transcript.duration,
        "paragraphs": paragraphs,
        "summary": summary,
    }

The return value is a plain dictionary combining three distinct pieces of value: the total meeting duration (useful metadata for a meeting archive), the structured, timestamp-anchored paragraphs (useful for a reader who wants to review or jump around the full transcript), and the generated summary (useful for someone who just wants the highlights without reading the whole thing). Returning a dictionary rather than, say, printing results directly, keeps this function reusable — a caller can render it to HTML, save it to a database, email it, or feed it into another process, none of which this function needs to know about.

Handling Long Meetings

A one-hour or longer meeting recording may exceed the transcription endpoint's per-request duration or file size limits. This workflow, as written, assumes the audio fits in a single request. Lesson 8 covers chunking strategies for long audio in detail; the key adjustment needed here is that transcribe_meeting would be replaced with a loop that transcribes sequential chunks and concatenates their segments (adjusting timestamps by each chunk's offset) before the grouping step runs. It is worth flagging this limitation now, because assuming any meeting audio will always fit in one request is one of the most common gaps in a first implementation of this workflow.

Testing the Workflow Logic

The parts of this workflow that do not call an API — segment grouping — can and should be tested directly with fake segment objects:

class FakeSegment:
    def __init__(self, start, end, text):
        self.start = start
        self.end = end
        self.text = text


def test_group_segments_splits_on_long_pause():
    segments = [
        FakeSegment(0.0, 2.0, "Let's get started."),
        FakeSegment(2.5, 4.0, "First item on the agenda."),
        FakeSegment(10.0, 12.0, "Moving on to the next topic."),
    ]
    paragraphs = group_segments_into_paragraphs(segments, max_gap_seconds=2.0)
    assert len(paragraphs) == 2
    assert paragraphs[0]["text"] == "Let's get started. First item on the agenda."
    assert paragraphs[1]["text"] == "Moving on to the next topic."
    print("PASS: group_segments_splits_on_long_pause")


def test_group_segments_splits_on_max_length():
    segments = [FakeSegment(i * 10, i * 10 + 5, f"Segment {i}.") for i in range(6)]
    paragraphs = group_segments_into_paragraphs(segments, max_gap_seconds=100.0, max_paragraph_seconds=20.0)
    assert len(paragraphs) > 1
    print("PASS: group_segments_splits_on_max_length")


test_group_segments_splits_on_long_pause()
test_group_segments_splits_on_max_length()

The first test confirms that a 6-second silence (between the segment ending at 4.0 and the next one starting at 10.0) correctly triggers a paragraph break given a 2-second gap threshold, and that the resulting text is joined correctly with spaces. The second test confirms the length-based fallback trigger works even when there is no meaningful pause at all, by using a very large max_gap_seconds (effectively disabling pause-based splitting) and a small max_paragraph_seconds, forcing the length check to be the only thing that can produce more than one paragraph. Testing each triggering condition independently, rather than only testing a combined "realistic" case, makes it much clearer which piece of logic is broken if a future change causes one of these tests to fail.

Common Mistakes

Treating pause-based paragraph grouping as true speaker identification, which causes incorrect assumptions in any downstream feature that tries to attribute paragraphs to specific people. This heuristic groups by pacing, not by speaker identity — a single speaker giving a long, pause-free explanation will appear as one long block, and two speakers talking without pausing will appear merged into one block.

Forgetting the final flush after the grouping loop, which causes the last paragraph of the meeting to be silently dropped from the output. Any accumulate-then-flush loop pattern like this one needs an explicit post-loop step to handle whatever remains in the accumulator.

Sending the entire raw transcript to the summarization call without first grouping or cleaning it, which works but produces noisier input (many tiny fragments) than necessary and can make it harder for the summarization step to correctly attribute context across sentence fragments. Cleaning and structuring the transcript first, as shown, generally produces a more coherent summary.

Best Practices

Keep each pipeline stage as an independently callable, independently testable function, as done here with transcribe_meeting, group_segments_into_paragraphs, and summarize_meeting_transcript. This makes it possible to swap or improve one stage (say, adding real diarization later) without rewriting the others.

Always pass a domain-relevant prompt to the transcription call for specialized content like meetings, since it meaningfully reduces name and jargon misspellings for a small, essentially free addition to the request.

Design the workflow's output as structured data (a dictionary or a well-defined object), not as a pre-formatted string. This keeps the workflow reusable across different presentation contexts — a web page, an email digest, a Slack message — without needing to change the underlying pipeline.

0 Comments

Reviewed before they appear

No comments yet.

OpenAI SDK
Introduction to the OpenAI SDK Setting Up Python Creating an API Key Your First Call — client.responses.create() and response.output_text Understanding Billing, Credits, and What a Request Costs Why Responses Replaced Chat Completions Anatomy of a Request: model, input, and instructions Anatomy of a Response: The Typed output Array, Not Just Text Roles: User, Assistant, and Developer/System Choosing a Model, and Reading the Models Page Instead of Memorizing Names Instructions vs. Input Writing Prompts That Get Consistent Results Few-Shot Examples Reasoning Models and the reasoning Parameter Debugging a Prompt That Misbehaves Why Streaming Matters for User Experience stream=True and Iterating Over Events Handling the Event Types You Actually Care About Background Mode for Long-Running Jobs Project — Add Live Streaming to Your Chatbot The Problem With Parsing Free Text JSON Schema and Strict Mode Pydantic Models With the SDK's Parse Helpers Handling Refusals and Validation Failures Project — A Resume-to-JSON Extractor Working With input_image input_file, PDFs, and the Files API Image Generation Speech-to-Text and Text-to-Speech Project: A PDF Question-Answering Script What Function Calling Is Defining a Tool Schema The Full Loop Multiple Tools Errors, Timeouts, and Untrusted Arguments Project: A Weather Assistant Web Search File Search and Vector Stores Code Interpreter Remote MCP Servers and Connectors Project: A Research Assistant What an Embedding Is, Without the Maths Generating and Storing Embeddings Similarity Search From Scratch Hosted Vector Stores vs. Rolling Your Own A Small RAG App Over a Folder of Notes Agents vs. a Single API Call — When You Need One pip install openai Giving Agents Tools Handoffs and Multi-Agent Triage Guardrails and Approvals Tracing and Observing What Your Agent Did A Multi-Agent Support Desk Error Codes and What Each One Means Retries, Timeouts, and Backoff Rate Limits and Spend Limits Prompt Caching and Cost Optimisation The Batch API for Bulk Work Async Clients and Concurrency Moderation and Safety Best Practices Designing the App Backend With FastAPI Streaming to a Simple Frontend Deploying and a Cost/Safety Checklist Why Web Search Is Useful for Current Information Using the Web Search Tool with the Responses API Configuring Search Behavior for Application Use Cases Understanding Citations and Source Attribution Where to Go Next Building a Research Assistant with Web Search Combining Web Search with Structured Outputs Handling Conflicting or Low-Quality Web Sources Reducing Unsupported Claims with Grounded Generation Testing Freshness-Sensitive AI Answers Production Considerations for Web-Grounded Applications Understanding File Search and Retrieval-Augmented Generation Creating and Organizing Vector Stores Uploading Documents for Retrieval Connecting Vector Stores to Responses API Requests Designing Document Metadata and Filtering Strategies Building a PDF Question-Answering Application Improving Retrieval Quality With Better Document Preparation Handling Missing Evidence and Retrieval Failures Combining File Search With Web Search Building a Production Knowledge-Base Assistant What the Code Interpreter Tool Is Designed For Running Python-Based Analysis Through the OpenAI SDK Uploading Datasets for Analysis Analyzing CSV and Spreadsheet Data Generating Charts and Data Summaries Handling Generated Files and Downloadable Artifacts Building a Data-Analysis Assistant Combining Code Execution with Structured Outputs Validating Generated Calculations and Results Security and Sandbox Considerations for Code Execution Understanding Multimodal Input with the OpenAI SDK Sending Images to a Model Image Analysis from URLs and Uploaded Files Extracting Text and Information from Screenshots Building an Image-Question-Answering Application Combining Image Input with Structured Output Analyzing Multiple Images in One Request Handling Image Quality and Input Limitations Designing Multimodal Prompts for Reliable Results Building a Practical Vision-Powered Python Application Understanding Speech-to-Text and Text-to-Speech Workflows Transcribing Audio with the OpenAI SDK Working with Uploaded Audio Files Handling Timestamps and Transcription Metadata Building a Meeting Transcription Workflow Generating Spoken Responses from Text Handling Long Audio and Processing Failures Combining Audio with Text and Tool Calling Building an End-to-End Python Voice Application What Embeddings Are and When to Use Them Generating Embeddings With the OpenAI API Preparing Text for Embedding Comparing Vectors With Cosine Similarity Building a Simple Semantic Search Engine in Python Storing Embeddings in a Database Metadata Filtering for Semantic Search Chunking Strategies for Better Retrieval Evaluating Semantic Search Quality Building a Document Similarity Application When Batch Processing Makes Sense Designing Large-Volume AI Processing Pipelines Using Asynchronous Python with the OpenAI SDK Running Concurrent Requests Safely Controlling Concurrency and Avoiding Rate Limits Tracking Batch Job Progress Handling Partial Failures in Bulk Workloads Retrying Failed Items Without Duplicating Successful Work Designing Resumable AI Processing Jobs Building a Production Batch-Processing Pipeline Batch Processing Makes Sense Large-Scale AI Processing Pipelines Async Python with OpenAI SDK Safe Concurrent Requests Concurrency & Rate Limits Batch Progress Tracking Partial Failure Handling Safe Retry Handling Resumable AI Jobs Production Batch Pipeline System–User Data Separation Reusable App Instructions Prompt Templates & Variables Extraction & Classification Prompts Summarization & Transformation Prompts Explicit Output Requirements Prompt Version Management Prompt Testing & Evaluation Reusable Python Prompt Library API Key Security Secure API Key Storage Secure Secret Management Prompt Injection Prevention Trusted vs. Untrusted Content Tool Argument Validation Sensitive Data Handling Secure Logging AI Action Authorization Production AI Security Checklist Why AI Applications Need Evaluation Beyond Unit Tests Unit Testing OpenAI SDK Integration Code Mocking API Responses in Python Tests Testing Structured Outputs Against Schemas Testing Tool-Calling Workflows Building a Small Evaluation Dataset Measuring Accuracy, Consistency, and Failure Rates Regression Testing Prompts and Model Changes Human Evaluation Versus Automated Evaluation Creating a Repeatable Evaluation Pipeline AI Request Monitoring Token Cost Management Usage Metrics Design Reducing Model Calls Prompt & Context Optimization Model Selection & Optimization AI Caching Strategies Interactive Latency Optimization Usage Dashboards & Budget Alerts Performance & Cost Checklist Every API Call Starts Fresh Fixing API Statelessness Server-Side Conversation Memory Limits of Response Chaining What We're Building Conversation Memory Challenges Preparing an OpenAI SDK Application for Deployment Environment-Specific Configuration for Development and Production Deploying a Python AI Service with Docker Container Health Checks and Startup Configuration Managing Secrets in Cloud Deployments Background Workers for Long-Running AI Tasks Queues and Asynchronous Job Architectures Scaling AI Workloads Horizontally Monitoring Production Incidents and Failures Production Deployment Checklist for OpenAI SDK Applications Reusable OpenAI Service Classes AI Client Dependency Injection Typed AI Responses Python Configuration Management AI Request Decorators Centralized AI Error Handling Clean SDK Abstractions Reusable OpenAI Utilities Internal AI Python Libraries SDK Integration Maintenance Production AI Chatbot Document Q&A System Web Research Assistant Customer Support Agent AI Data Analysis Assistant Image Analysis App Meeting Transcription & Summary Semantic Document Search Multi-Tool AI Agent Production OpenAI SDK App Why "It Looked Fine When I Tested It" Isn't Enough Timing Note Status Note Pre-Decision Status Note Current Availability Note
Ask about this post
AI Ask about this post

Ask questions about Building a Meeting Transcription Workflow and get answers drawn from it.

Signed-in readers only.