Deserialize content that may be null (some OpenAI-compatible APIs return `"content": null` for tool-call-only responses).
(deserializer: D)
| 55 | /// Deserialize content that may be null (some OpenAI-compatible APIs return |
| 56 | /// `"content": null` for tool-call-only responses). |
| 57 | fn deserialize_content<'de, D>(deserializer: D) -> Result<Content, D::Error> |
| 58 | where |
| 59 | D: serde::Deserializer<'de>, |
| 60 | { |
| 61 | let value: Option<Content> = Option::deserialize(deserializer)?; |
| 62 | Ok(value.unwrap_or_else(|| Content::Text(String::new()))) |
| 63 | } |
| 64 | |
| 65 | #[derive(Debug, Clone, Serialize, Deserialize)] |
| 66 | #[serde(rename_all = "lowercase")] |