1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//! Parakeet STT provider for AutoAgents Speech framework
//!
//! This module provides Parakeet (NVIDIA) implementations for the AutoAgents STT trait system.
//!
//! # Supported Models
//!
//! - **TDT**: Multilingual model with 25 language support and timestamp capabilities
//! - **Nemotron**: Streaming-optimized model for real-time transcription (English only)
//! - **EOU**: Real-time streaming with end-of-utterance detection (English only)
//!
//! # Examples
//!
//! ## TDT (Multilingual with timestamps)
//!
//! ```no_run
//! use autoagents_speech::providers::parakeet::{Parakeet, ParakeetConfig, ModelVariant};
//! use autoagents_speech::{STTSpeechProvider, TranscriptionRequest, AudioData, SharedAudioData};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create provider with TDT model
//! let config = ParakeetConfig::new(ModelVariant::TDT, "./models/tdt");
//! let provider = Parakeet::new(config)?;
//!
//! // Transcribe with timestamps
//! let request = TranscriptionRequest {
//! audio: SharedAudioData::new(AudioData {
//! samples: vec![0.0; 16000], // 1 second of audio
//! sample_rate: 16000,
//! channels: 1,
//! }),
//! language: None, // Auto-detect
//! include_timestamps: true,
//! };
//!
//! let response = provider.transcribe(request).await?;
//! println!("Transcription: {}", response.text);
//!
//! if let Some(timestamps) = response.timestamps {
//! for token in timestamps {
//! println!("[{:.2}s - {:.2}s] {}", token.start, token.end, token.text);
//! }
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Nemotron (Streaming for real-time)
//!
//! ```no_run
//! use autoagents_speech::providers::parakeet::{Parakeet, ParakeetConfig, ModelVariant};
//! use autoagents_speech::{STTSpeechProvider, TranscriptionRequest, AudioData, SharedAudioData};
//! use futures::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create provider with Nemotron model
//! let config = ParakeetConfig::new(ModelVariant::Nemotron, "./models/nemotron");
//! let provider = Parakeet::new(config)?;
//!
//! // Stream transcription
//! let request = TranscriptionRequest {
//! audio: SharedAudioData::new(AudioData {
//! samples: vec![0.0; 16000 * 10], // 10 seconds of audio
//! sample_rate: 16000,
//! channels: 1,
//! }),
//! language: Some("en".to_string()),
//! include_timestamps: false,
//! };
//!
//! let mut stream = provider.transcribe_stream(request).await?;
//!
//! while let Some(chunk) = stream.next().await {
//! let chunk = chunk?;
//! print!("{}", chunk.text);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## EOU (Streaming with End-of-Utterance Detection)
//!
//! ```no_run
//! use autoagents_speech::providers::parakeet::{Parakeet, ParakeetConfig, ModelVariant};
//! use autoagents_speech::{STTSpeechProvider, TranscriptionRequest, AudioData, SharedAudioData};
//! use futures::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Create provider with EOU model
//! let config = ParakeetConfig::new(ModelVariant::EOU, "./models/eou");
//! let provider = Parakeet::new(config)?;
//!
//! // Stream transcription with EOU detection
//! let request = TranscriptionRequest {
//! audio: SharedAudioData::new(AudioData {
//! samples: vec![0.0; 16000 * 10], // 10 seconds of audio
//! sample_rate: 16000,
//! channels: 1,
//! }),
//! language: Some("en".to_string()),
//! include_timestamps: false,
//! };
//!
//! let mut stream = provider.transcribe_stream(request).await?;
//!
//! while let Some(chunk) = stream.next().await {
//! let chunk = chunk?;
//!
//! if chunk.is_final {
//! // End of utterance detected
//! println!("\n[EOU detected] {}", chunk.text);
//! } else {
//! print!("{}", chunk.text);
//! }
//! }
//!
//! Ok(())
//! }
//! ```
// Re-exports
pub use ParakeetConfig;
pub use ;
pub use ModelVariant;
pub use Parakeet;