simple_agents_core/
healing.rs1use simple_agent_type::coercion::CoercionResult;
4use simple_agent_type::prelude::CompletionResponse;
5use simple_agents_healing::coercion::CoercionConfig;
6use simple_agents_healing::parser::ParserConfig;
7use simple_agents_healing::parser::ParserResult;
8
9#[derive(Debug, Clone)]
11pub struct HealingSettings {
12 pub enabled: bool,
14 pub parser_config: ParserConfig,
16 pub coercion_config: CoercionConfig,
18}
19
20impl Default for HealingSettings {
21 fn default() -> Self {
22 Self {
23 enabled: true,
24 parser_config: ParserConfig::default(),
25 coercion_config: CoercionConfig::default(),
26 }
27 }
28}
29
30impl HealingSettings {
31 pub fn new() -> Self {
33 Self::default()
34 }
35
36 pub fn disabled() -> Self {
38 Self {
39 enabled: false,
40 ..Self::default()
41 }
42 }
43
44 pub fn with_parser_config(mut self, config: ParserConfig) -> Self {
46 self.parser_config = config;
47 self
48 }
49
50 pub fn with_coercion_config(mut self, config: CoercionConfig) -> Self {
52 self.coercion_config = config;
53 self
54 }
55}
56
57pub struct HealedJsonResponse {
59 pub response: CompletionResponse,
61 pub parsed: ParserResult,
63}
64
65pub struct HealedSchemaResponse {
67 pub response: CompletionResponse,
69 pub parsed: ParserResult,
71 pub coerced: CoercionResult<serde_json::Value>,
73}