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
//! `OpenAI` Provider Module
//!
//! Modular implementation of `OpenAI` API client with capability separation.
//! This module follows the design pattern of separating different AI capabilities
//! into distinct modules while providing a unified client interface.
//!
//! # Architecture
//! - `client.rs` - Main `OpenAI` client that aggregates all capabilities
//! - `config.rs` - Configuration structures and validation
//! - `builder.rs` - Builder pattern implementation for client creation
//! - `chat.rs` - Chat completion capability implementation
//! - `audio.rs` - Audio processing (TTS/STT) capability implementation
//! - `embeddings.rs` - Text embedding capability implementation
//! - `images.rs` - Image generation capability implementation
//! - `files.rs` - File management capability implementation
//! - `models.rs` - Model listing capability implementation (future)
//! - `moderation.rs` - Content moderation capability implementation
//! - `types.rs` - OpenAI-specific type definitions
//! - `utils.rs` - Utility functions and helpers
//!
//! # Example Usage
//! ```rust,no_run
//! use siumai::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let client = LlmBuilder::new()
//! .openai()
//! .api_key("your-api-key")
//! .model("gpt-4")
//! .build()
//! .await?;
//!
//! // Use chat capability
//! let messages = vec![user!("Hello, world!")];
//! let response = client.chat(messages).await?;
//!
//! // Use audio capability (if available)
//! // let audio_data = client.speech("Hello, world!").await?;
//!
//! // Use embedding capability (if available)
//! // let embeddings = client.embed(vec!["Hello, world!".to_string()]).await?;
//!
//! Ok(())
//! }
//! ```
// Core modules
// Capability modules
// Request building module
// Future capability modules (placeholders)
// Model constants module
// Re-export main types for convenience
pub use OpenAiBuilder;
pub use OpenAiClient;
pub use OpenAiConfig;
pub use *;
// Re-export capability implementations
pub use OpenAiAudio;
pub use OpenAiChatCapability;
pub use OpenAiEmbeddings;
pub use OpenAiFiles;
pub use OpenAiImages;
pub use OpenAiModels;
pub use OpenAiModeration;
pub use OpenAiRerank;
pub use ;
// Re-export parameter enums for convenience
pub use crate;
// Test modules