Skip to content

[Enhancement] Add pipeline composition helpers for chaining STT, Intelligence, and TTS operations #745

Description

@deepgram-robot

Summary

Add convenience methods for composing multi-step Deepgram API pipelines — STT → Audio Intelligence → TTS — as a single fluent chain, reducing boilerplate and making common multi-API workflows expressible in a few lines.

Problem it solves

Developers frequently need to chain Deepgram APIs together: transcribe audio, run intelligence analysis (sentiment, topics, entities), then synthesize a summary or response via TTS. Today this requires manually wiring together three separate API calls, handling intermediate data transformation, and managing error propagation across the chain. A pipeline composition helper would make these common patterns as simple as:

result = await (
    deepgram.pipeline()
    .transcribe(audio_source, model="nova-3")
    .analyze(sentiment=True, topics=True, summarize=True)
    .speak(model="aura-2", voice="asteria")
    .run()
)
# result.transcript, result.intelligence, result.audio

This mirrors the operator-overloaded pipeline composition pattern becoming standard in AI frameworks, making Deepgram's multi-API workflows competitive in ergonomics.

Proposed API

from deepgram import DeepgramClient, Pipeline

client = DeepgramClient()

# Fluent pipeline builder
pipeline = (
    client.pipeline()
    .transcribe(source={"url": "https://example.com/audio.wav"}, model="nova-3", smart_format=True)
    .analyze(sentiment=True, topics=True, summarize="v2")
    .speak(text_from="summary", model="aura-2-en", encoding="mp3")
)

result = await pipeline.run()
# result.transcript: PrerecordedResponse
# result.intelligence: AnalyzeResponse  
# result.audio: bytes (TTS output)

# Or partial pipelines
stt_result = await client.pipeline().transcribe(source=audio).run()
stt_intel = await client.pipeline().transcribe(source=audio).analyze(sentiment=True).run()

Acceptance criteria

  • Pipeline class supports .transcribe(), .analyze(), and .speak() steps
  • Steps can be composed in any valid order (transcribe → analyze, transcribe → speak, transcribe → analyze → speak)
  • Error in any step propagates with clear context about which step failed
  • Intermediate results are accessible on the pipeline result object
  • Documented with usage example
  • Compatible with existing API (does not change any existing client methods)

Raised by the DX intelligence system.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions