model_runtime/
predictions.rs1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)]
7pub struct RawPrediction {
8 pub kind: Option<String>,
10 pub label: Option<String>,
12 pub text: Option<String>,
14 pub score: Option<f32>,
16 #[serde(default)]
18 pub attributes: BTreeMap<String, String>,
19}
20
21impl RawPrediction {
22 pub fn label(label: impl Into<String>, score: f32) -> Self {
24 Self {
25 label: Some(label.into()),
26 score: Some(score),
27 ..Self::default()
28 }
29 }
30}