usederive_more::From;useserde::{Deserialize, Serialize};useserde_json::Value;usevalue_ext::JsonValueExt as_;usecrate::{ModelIden,adapter::AdapterKind};/// Custom Content Part containing the raw json value of that part from the provider/model
/// `.model_iden` will always be captured if this is part of a response
#[derive(Debug, Clone, Serialize, Deserialize, From)]pubstructCustomPart{pubmodel_iden:Option<ModelIden>,
pubdata: Value,
}implCustomPart{pubfndata(&self)->&Value{&self.data
}pubfnadapter_kind(&self)->Option<AdapterKind>{self.model_iden.as_ref().map(|m|m.adapter_kind)}/// Returns the "type" field from the data, if it exists and is a string.
pubfntyp(&self)->Option<&str>{self.data.x_get_str("type").ok()}}