(&self, content: &Content)
| 178 | } |
| 179 | |
| 180 | fn content_to_parts(&self, content: &Content) -> Vec<VertexPart> { |
| 181 | match content { |
| 182 | Content::Text(text) => vec![VertexPart::text(text)], |
| 183 | Content::Parts(parts) => parts |
| 184 | .iter() |
| 185 | .filter_map(|p| { |
| 186 | if let Some(text) = &p.text { |
| 187 | Some(VertexPart::text(text)) |
| 188 | } else if let Some(tool_use) = &p.tool_use { |
| 189 | Some(VertexPart::function_call( |
| 190 | &tool_use.name, |
| 191 | tool_use.input.clone(), |
| 192 | )) |
| 193 | } else { |
| 194 | None |
| 195 | } |
| 196 | }) |
| 197 | .collect(), |
| 198 | } |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | #[async_trait] |