(
&mut self,
parse_error: &str,
max_parse_retries: u32,
)
| 134 | } |
| 135 | |
| 136 | pub(super) fn record_parse_error( |
| 137 | &mut self, |
| 138 | parse_error: &str, |
| 139 | max_parse_retries: u32, |
| 140 | ) -> ParseErrorOutcome { |
| 141 | self.parse_error_count += 1; |
| 142 | let output = format!("Error: {}", parse_error); |
| 143 | let fatal_message = (self.parse_error_count > max_parse_retries).then(|| { |
| 144 | format!( |
| 145 | "LLM produced malformed tool arguments {} time(s) in a row \ |
| 146 | (max_parse_retries={}); giving up", |
| 147 | self.parse_error_count, max_parse_retries |
| 148 | ) |
| 149 | }); |
| 150 | |
| 151 | ParseErrorOutcome { |
| 152 | output, |
| 153 | count: self.parse_error_count, |
| 154 | fatal_message, |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | pub(super) fn reset_parse_errors(&mut self) { |
| 159 | self.parse_error_count = 0; |
no outgoing calls