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
//! Core RealtimeModel trait definition.
use crateAudioFormat;
use crateRealtimeConfig;
use crateResult;
use crateBoxedSession;
use async_trait;
/// A factory for creating real-time sessions.
///
/// Each provider (OpenAI, Gemini, etc.) implements this trait to provide
/// their specific realtime connection logic.
///
/// # Example
///
/// ```rust,ignore
/// use adk_realtime::{RealtimeModel, RealtimeConfig};
/// use adk_realtime::openai::OpenAIRealtimeModel;
///
/// #[tokio::main]
/// async fn main() -> Result<()> {
/// let model = OpenAIRealtimeModel::new(api_key, "gpt-4o-realtime-preview-2024-12-17");
///
/// let config = RealtimeConfig::default()
/// .with_instruction("You are a helpful assistant.")
/// .with_voice("alloy");
///
/// let session = model.connect(config).await?;
///
/// // Use the session...
///
/// session.close().await?;
/// Ok(())
/// }
/// ```
/// A shared model type for thread-safe dynamic dispatch.
pub type BoxedModel = Arc;