Summary
Implement the futures::Stream trait for streaming transcription results, enabling Rust-idiomatic consumption of real-time transcription events using StreamExt combinators (.filter(), .map(), .take_while(), etc.) and seamless composition with the Rust async ecosystem (Tokio, async-std, tower).
Problem it solves
Rust developers expect streaming data to implement the Stream trait — it is the async equivalent of Iterator and the standard way to compose async data pipelines. Currently, consuming streaming transcription results requires callback registration, which breaks composition with Rust's rich async ecosystem. Developers cannot use StreamExt methods to filter, transform, or combine transcription streams with other async data sources. This friction makes the SDK feel non-idiomatic and increases the code required for common patterns like "take transcripts until silence" or "merge transcripts from two concurrent sessions."
Proposed API
use deepgram::stream::TranscriptionStream;
use futures::StreamExt;
let client = Deepgram::new(api_key);
// Returns a Stream<Item = TranscriptionEvent>
let mut stream: TranscriptionStream = client
.transcription()
.stream_audio(audio_source, options)
.await?;
// Idiomatic Stream consumption
while let Some(event) = stream.next().await {
match event? {
TranscriptionEvent::Transcript(t) if t.is_final => {
println!("{}", t.transcript);
}
TranscriptionEvent::UtteranceEnd(_) => break,
_ => {}
}
}
// Or with combinators
let final_transcripts: Vec<String> = stream
.filter_map(|e| async move {
match e.ok()? {
TranscriptionEvent::Transcript(t) if t.is_final => Some(t.transcript),
_ => None,
}
})
.collect()
.await;
Acceptance criteria
Raised by the DX intelligence system.
Summary
Implement the
futures::Streamtrait for streaming transcription results, enabling Rust-idiomatic consumption of real-time transcription events usingStreamExtcombinators (.filter(),.map(),.take_while(), etc.) and seamless composition with the Rust async ecosystem (Tokio, async-std, tower).Problem it solves
Rust developers expect streaming data to implement the
Streamtrait — it is the async equivalent ofIteratorand the standard way to compose async data pipelines. Currently, consuming streaming transcription results requires callback registration, which breaks composition with Rust's rich async ecosystem. Developers cannot useStreamExtmethods to filter, transform, or combine transcription streams with other async data sources. This friction makes the SDK feel non-idiomatic and increases the code required for common patterns like "take transcripts until silence" or "merge transcripts from two concurrent sessions."Proposed API
Acceptance criteria
futures::Stream<Item = Result<TranscriptionEvent, Error>>StreamExtcombinators (filter, map, take_while, etc.)Raised by the DX intelligence system.