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
//! Core output parser trait.
use crateSynwireError;
/// Trait for parsing model output into structured types.
///
/// Output parsers transform raw text from language models into structured data.
/// Implement this trait to create custom parsers for specific output formats.
///
/// # Examples
///
/// ```
/// use synwire_core::output_parsers::OutputParser;
/// use synwire_core::error::SynwireError;
///
/// struct UpperCaseParser;
///
/// impl OutputParser for UpperCaseParser {
/// type Output = String;
///
/// fn parse(&self, text: &str) -> Result<String, SynwireError> {
/// Ok(text.to_uppercase())
/// }
/// }
/// ```