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
//! OpenAI Realtime API provider.
//!
//! This module provides the OpenAI implementation of the realtime traits,
//! connecting to OpenAI's WebSocket-based Realtime API.
//!
//! # Example
//!
//! ```rust,ignore
//! use adk_realtime::openai::OpenAIRealtimeModel;
//! use adk_realtime::{RealtimeModel, RealtimeConfig};
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let model = OpenAIRealtimeModel::new(
//! std::env::var("OPENAI_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(())
//! }
//! ```
pub use OpenAIRealtimeModel;
pub use ;
pub use OpenAIRealtimeSession;
pub use OpenAIWebRTCSession;
pub use OpusCodec;
/// OpenAI Realtime API WebSocket URL.
pub const OPENAI_REALTIME_URL: &str = "wss://api.openai.com/v1/realtime";
/// Available voices for OpenAI Realtime.
pub const OPENAI_VOICES: & =
&;
/// Default model for OpenAI Realtime.
pub const DEFAULT_MODEL: &str = "gpt-4o-realtime-preview-2024-12-17";
/// Transport type for OpenAI Realtime connections.
///
/// By default, connections use WebSocket. When the `openai-webrtc` feature is
/// enabled, WebRTC transport is also available for lower-latency audio.