Realtime Transcript Generator (utils/transcript.py)

dograh · api/utils/transcript.py · python · BSD-2-Clause
voice, ai, realtime, lang:python

A utility to convert realtime feedback events into formatted transcript text. Use this for processing and displaying conversation logs from voice or chat AI services.

# Source: https://github.com/dograh-hq/dograh | License: BSD-2-Clause | Copyright 2025, Zansat Technologies Private Limited
# Provided via justclaw.it.com; keep this notice with the code.
from typing import List

from pipecat.utils.enums import RealtimeFeedbackType


def _format_timestamp_range(
    payload: dict, event: dict, include_end_timestamps: bool
) -> str:
    start_timestamp = payload.get("timestamp") or event.get("timestamp", "")
    if not include_end_timestamps:
        return start_timestamp

    end_timestamp = payload.get("end_timestamp")
    if end_timestamp:
        return (
            f"{start_timestamp} -> {end_timestamp}"
            if start_timestamp
            else end_timestamp
        )
    return start_timestamp


def generate_transcript_text(
    events: List[

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key