windmill_api/models/ai_decision.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.824.1
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// AiDecision : AI decision step: one call to a decision model (TypeSafe's Jev, or Cloudflare's Jev-compatible Clef) that answers typed questions about a state with calibrated probabilities, instead of generating text. Prefer it over an AI agent to classify, route, score or check something: it is fast, cheap and its answers are structured. Its result is { output: { <question name>: answer }, model, usage }, so a later step reads e.g. results.<id>.output.intent.choice. To route on the answers, follow it with a branchone whose branch exprs read results.<id>.output.<question>.choice. Usable as an AI agent tool, where the calling agent supplies the state.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct AiDecision {
17 #[serde(rename = "input_transforms")]
18 pub input_transforms: Box<models::AiDecisionInputTransforms>,
19 #[serde(rename = "type")]
20 pub r#type: Type,
21 /// Worker group tag for execution routing. If not set, the step runs on the flow's tag (default `flow`)
22 #[serde(rename = "tag", skip_serializing_if = "Option::is_none")]
23 pub tag: Option<String>,
24}
25
26impl AiDecision {
27 /// AI decision step: one call to a decision model (TypeSafe's Jev, or Cloudflare's Jev-compatible Clef) that answers typed questions about a state with calibrated probabilities, instead of generating text. Prefer it over an AI agent to classify, route, score or check something: it is fast, cheap and its answers are structured. Its result is { output: { <question name>: answer }, model, usage }, so a later step reads e.g. results.<id>.output.intent.choice. To route on the answers, follow it with a branchone whose branch exprs read results.<id>.output.<question>.choice. Usable as an AI agent tool, where the calling agent supplies the state.
28 pub fn new(input_transforms: models::AiDecisionInputTransforms, r#type: Type) -> AiDecision {
29 AiDecision {
30 input_transforms: Box::new(input_transforms),
31 r#type,
32 tag: None,
33 }
34 }
35}
36///
37#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
38pub enum Type {
39 #[serde(rename = "aidecision")]
40 Aidecision,
41}
42
43impl Default for Type {
44 fn default() -> Type {
45 Self::Aidecision
46 }
47}
48