windmill_api/models/eval_subject.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/// EvalSubject : What an eval run is executed against.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct EvalSubject {
17 /// `agent` runs the ai_agent resource as it is deployed when the run opens, `agent_draft` the caller's unsaved edits of it as the editor holds them (carried in `draft`), and `agent_version` one past version named by `version`. The first and last are read server-side; all three are inlined into the run, so every case of a run executes one configuration: a deploy part-way through changes what the next run measures, never this one.
18 #[serde(rename = "kind")]
19 pub kind: Kind,
20 /// Path of the ai_agent resource.
21 #[serde(rename = "path")]
22 pub path: String,
23 /// The agent's per-path version number when the run opened: how many times the resource had been saved, not a resource_version row id. For `agent` and `agent_draft` it names the configuration the run read and every case executed. For `agent_version` it is the request's own, says which version to inline, and is required.
24 #[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25 pub version: Option<Option<i64>>,
26 #[serde(rename = "draft", skip_serializing_if = "Option::is_none")]
27 pub draft: Option<Box<models::AgentDraft>>,
28 /// Hash of the configuration a draft run executed, stamped server-side. A draft moves without the version moving, so this is what dates a run of one. It is also what recognises a draft run whose configuration was later deployed: when it matches the agent as deployed, the run's kind and version are rewritten to that version, once, and the hash is kept as what the resolution rests on.
29 #[serde(rename = "draft_hash", skip_serializing_if = "Option::is_none")]
30 pub draft_hash: Option<String>,
31}
32
33impl EvalSubject {
34 /// What an eval run is executed against.
35 pub fn new(kind: Kind, path: String) -> EvalSubject {
36 EvalSubject {
37 kind,
38 path,
39 version: None,
40 draft: None,
41 draft_hash: None,
42 }
43 }
44}
45/// `agent` runs the ai_agent resource as it is deployed when the run opens, `agent_draft` the caller's unsaved edits of it as the editor holds them (carried in `draft`), and `agent_version` one past version named by `version`. The first and last are read server-side; all three are inlined into the run, so every case of a run executes one configuration: a deploy part-way through changes what the next run measures, never this one.
46#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
47pub enum Kind {
48 #[serde(rename = "agent")]
49 Agent,
50 #[serde(rename = "agent_draft")]
51 AgentDraft,
52 #[serde(rename = "agent_version")]
53 AgentVersion,
54}
55
56impl Default for Kind {
57 fn default() -> Kind {
58 Self::Agent
59 }
60}
61