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
//! Server-Sent Events (SSE) processing for different AI providers
//!
//! This module provides a modular, configuration-driven architecture for parsing
//! SSE streams from different AI providers (OpenAI, Claude, etc.) into our standard
//! StreamItem format.
//!
//! ## Architecture
//!
//! The SSE processing uses a unified approach where provider differences are expressed
//! as configuration rather than separate implementations:
//!
//! - `core/` - Core processing logic and the `TokenExtractor` trait
//! - `extractors/` - `JsonPathExtractor` with provider-specific configurations
//! - `providers/` - `ConfigurableSSEProvider` with factory methods
//! - `utils/` - Backwards compatibility helpers
//!
//! ## Usage
//!
//! ```rust,ignore
//! use cllient::streaming::sse::{ConfigurableSSEProvider, openai_provider, claude_provider};
//!
//! // Create provider using factory function
//! let openai = openai_provider();
//! let claude = claude_provider();
//!
//! // Or use the ConfigurableSSEProvider directly
//! let openai = ConfigurableSSEProvider::openai();
//! let claude = ConfigurableSSEProvider::claude();
//! ```
//!
//! ## Adding New Providers
//!
//! To add support for a new provider, create a new configuration function in
//! `extractors/mod.rs` that returns an `ExtractorConfig` with the appropriate
//! JSON paths and end conditions.
// Re-export core types
pub use ;
// Re-export extractor types and configurations
pub use ;
// Re-export provider types and factory functions
pub use ;
// Re-export utility function for backwards compatibility
pub use stream_from_sse_bytes;