(&self)
| 348 | |
| 349 | impl InvokeOutput { |
| 350 | pub fn as_str(&self) -> Cow<'_, str> { |
| 351 | match &self.output { |
| 352 | OutputKind::Text(s) => s.as_str().into(), |
| 353 | OutputKind::Json(j) => serde_json::to_string(j) |
| 354 | .map_err(|err| error!(?err, "failed to serialize tool to json")) |
| 355 | .unwrap_or_default() |
| 356 | .into(), |
| 357 | OutputKind::Images(_) => "".into(), |
| 358 | OutputKind::Mixed { text, .. } => text.as_str().into(), // Return the text part |
| 359 | } |
| 360 | } |
| 361 | } |
| 362 | |
| 363 | #[non_exhaustive] |
no outgoing calls