windmill_api/models/scorer.rs
1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.796.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Scorer : A scorer is a column of the results table, and it is always a runnable: an ai_agent resource sent the run to grade, or a script handed the run as an argument. `id` is assigned when the scorer is added to a dataset and never reused: it is what makes a column the same column across experiments when the scorer is renamed, and a delta is only ever computed between two scores carrying the same id. A scorer sent without an id is given one.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Scorer {
17 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
18 pub id: Option<String>,
19 /// Column header. Defaults to the last segment of the path.
20 #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
21 pub name: Option<String>,
22 /// A score at or above this counts as a pass, and the column reports a pass rate beside its mean. Applied when results are read rather than when they are produced, so moving the line re-reads every score already recorded instead of invalidating them.
23 #[serde(rename = "pass_if", skip_serializing_if = "Option::is_none")]
24 pub pass_if: Option<f64>,
25 #[serde(rename = "kind")]
26 pub kind: Kind,
27 /// The script, or the ai_agent resource used as a judge.
28 #[serde(rename = "path")]
29 pub path: String,
30}
31
32impl Scorer {
33 /// A scorer is a column of the results table, and it is always a runnable: an ai_agent resource sent the run to grade, or a script handed the run as an argument. `id` is assigned when the scorer is added to a dataset and never reused: it is what makes a column the same column across experiments when the scorer is renamed, and a delta is only ever computed between two scores carrying the same id. A scorer sent without an id is given one.
34 pub fn new(kind: Kind, path: String) -> Scorer {
35 Scorer {
36 id: None,
37 name: None,
38 pass_if: None,
39 kind,
40 path,
41 }
42 }
43}
44///
45#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
46pub enum Kind {
47 #[serde(rename = "script")]
48 Script,
49 #[serde(rename = "agent")]
50 Agent,
51}
52
53impl Default for Kind {
54 fn default() -> Kind {
55 Self::Script
56 }
57}
58