{
 "schema_version": "1.0",
 "nodes": [
  {
   "id": "brief",
   "type": "input/text",
   "label": "Brief",
   "parameters": {
    "required": true,
    "multiline": true,
    "text": "A hand-thrown stoneware espresso cup in matte sage green, on a plain white background, seen from the side at eye level, soft daylight, no saucer, no text, no logo."
   }
  },
  {
   "id": "make",
   "type": "ai/text_to_image",
   "label": "Four pictures from the brief",
   "parameters": {
    "variants": 4
   },
   "model": {
    "model": "flux-schnell"
   }
  },
  {
   "id": "context",
   "type": "text/template",
   "label": "Brief for the judge",
   "parameters": {
    "template": "The brief the four pictures were made from:\n[brief]\nThe pictures follow, labelled Picture 1 to Picture 4.",
    "placeholders": {
     "placeholders": [
      {
       "inputPort": "brief",
       "name": "brief"
      }
     ]
    }
   }
  },
  {
   "id": "judge",
   "type": "ai/decide",
   "label": "Choose the picture that fits the brief",
   "parameters": {
    "questions": {
     "schema": "madoo.decision-questions/v1",
     "questions": [
      {
       "name": "best",
       "type": "choice",
       "instructions": "Which picture fits the brief best: the object, its colour, the background and the view it asks for?",
       "options": [
        {
         "value": "picture_1"
        },
        {
         "value": "picture_2"
        },
        {
         "value": "picture_3"
        },
        {
         "value": "picture_4"
        }
       ],
       "threshold": 0.7
      },
      {
       "name": "no_text",
       "type": "yes_no",
       "instructions": "None of the pictures shows text, letters, numbers or a logo.",
       "threshold": 0.8
      }
     ]
    },
    "image_detail": "low"
   }
  },
  {
   "id": "deliver",
   "type": "utility/select_by_key",
   "label": "The chosen picture",
   "parameters": {
    "selectionConfig": {
     "valueType": "image",
     "onNoMatch": "fail",
     "caseSensitive": true,
     "cases": [
      {
       "key": "picture_1",
       "inputPort": "picture_1",
       "label": "Picture 1"
      },
      {
       "key": "picture_2",
       "inputPort": "picture_2",
       "label": "Picture 2"
      },
      {
       "key": "picture_3",
       "inputPort": "picture_3",
       "label": "Picture 3"
      },
      {
       "key": "picture_4",
       "inputPort": "picture_4",
       "label": "Picture 4"
      }
     ]
    }
   }
  },
  {
   "id": "o_image",
   "type": "output/image",
   "label": "Delivered picture",
   "parameters": {
    "output_name": "picture"
   }
  },
  {
   "id": "o_best",
   "type": "output/text",
   "label": "Chosen",
   "parameters": {
    "output_name": "chosen"
   }
  },
  {
   "id": "o_best_p",
   "type": "output/json",
   "label": "Chosen — probability",
   "parameters": {
    "output_name": "chosen_probability"
   }
  },
  {
   "id": "o_no_text",
   "type": "output/json",
   "label": "No text or logo",
   "parameters": {
    "output_name": "no_text"
   }
  },
  {
   "id": "o_decision",
   "type": "output/json",
   "label": "Decision",
   "parameters": {
    "output_name": "decision"
   }
  },
  {
   "id": "o_v1",
   "type": "output/image",
   "label": "Picture 1",
   "parameters": {
    "output_name": "picture_1"
   }
  },
  {
   "id": "o_v2",
   "type": "output/image",
   "label": "Picture 2",
   "parameters": {
    "output_name": "picture_2"
   }
  },
  {
   "id": "o_v3",
   "type": "output/image",
   "label": "Picture 3",
   "parameters": {
    "output_name": "picture_3"
   }
  },
  {
   "id": "o_v4",
   "type": "output/image",
   "label": "Picture 4",
   "parameters": {
    "output_name": "picture_4"
   }
  }
 ],
 "connections": [
  {
   "from_node": "brief",
   "from_output": "text",
   "to_node": "make",
   "to_input": "prompt"
  },
  {
   "from_node": "brief",
   "from_output": "text",
   "to_node": "context",
   "to_input": "brief"
  },
  {
   "from_node": "context",
   "from_output": "result",
   "to_node": "judge",
   "to_input": "content"
  },
  {
   "from_node": "make",
   "from_output": "variant_1",
   "to_node": "judge",
   "to_input": "images_0"
  },
  {
   "from_node": "make",
   "from_output": "variant_2",
   "to_node": "judge",
   "to_input": "images_1"
  },
  {
   "from_node": "make",
   "from_output": "variant_3",
   "to_node": "judge",
   "to_input": "images_2"
  },
  {
   "from_node": "make",
   "from_output": "variant_4",
   "to_node": "judge",
   "to_input": "images_3"
  },
  {
   "from_node": "judge",
   "from_output": "best",
   "to_node": "deliver",
   "to_input": "selector"
  },
  {
   "from_node": "make",
   "from_output": "variant_1",
   "to_node": "deliver",
   "to_input": "picture_1"
  },
  {
   "from_node": "make",
   "from_output": "variant_2",
   "to_node": "deliver",
   "to_input": "picture_2"
  },
  {
   "from_node": "make",
   "from_output": "variant_3",
   "to_node": "deliver",
   "to_input": "picture_3"
  },
  {
   "from_node": "make",
   "from_output": "variant_4",
   "to_node": "deliver",
   "to_input": "picture_4"
  },
  {
   "from_node": "deliver",
   "from_output": "selected_value",
   "to_node": "o_image",
   "to_input": "image"
  },
  {
   "from_node": "judge",
   "from_output": "best",
   "to_node": "o_best",
   "to_input": "text"
  },
  {
   "from_node": "judge",
   "from_output": "best_probability",
   "to_node": "o_best_p",
   "to_input": "json"
  },
  {
   "from_node": "judge",
   "from_output": "no_text",
   "to_node": "o_no_text",
   "to_input": "json"
  },
  {
   "from_node": "judge",
   "from_output": "decision",
   "to_node": "o_decision",
   "to_input": "json"
  },
  {
   "from_node": "make",
   "from_output": "variant_1",
   "to_node": "o_v1",
   "to_input": "image"
  },
  {
   "from_node": "make",
   "from_output": "variant_2",
   "to_node": "o_v2",
   "to_input": "image"
  },
  {
   "from_node": "make",
   "from_output": "variant_3",
   "to_node": "o_v3",
   "to_input": "image"
  },
  {
   "from_node": "make",
   "from_output": "variant_4",
   "to_node": "o_v4",
   "to_input": "image"
  }
 ]
}