(
&self,
request: LlmRequest,
next: crate::api::runtime::LlmExecutionNextFn,
enable_input: bool,
enable_output: bool,
)
| 132 | } |
| 133 | |
| 134 | async fn execute_llm( |
| 135 | &self, |
| 136 | request: LlmRequest, |
| 137 | next: crate::api::runtime::LlmExecutionNextFn, |
| 138 | enable_input: bool, |
| 139 | enable_output: bool, |
| 140 | ) -> FlowResult<Json> { |
| 141 | let (request, messages) = self.prepare_llm_request(request, enable_input).await?; |
| 142 | let response = next(request).await?; |
| 143 | |
| 144 | if enable_output { |
| 145 | let annotated_response = self.codec()?.decode_response(&response)?; |
| 146 | if let Some(response_text) = annotated_response.response_text() { |
| 147 | self.check_output_rails(&messages, response_text).await?; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | Ok(response) |
| 152 | } |
| 153 | |
| 154 | async fn execute_llm_stream( |
| 155 | &self, |
no test coverage detected