{
  "version": "3.15",
  "name": "Test13: Deep Nesting - Loop with Branch routing to different LLMs",
  "registry": {
    "params": [],
    "vars": ["$data([OBJECT])", "$results([STRING])"]
  },
  "steps": [
    {
      "id": "Set_Data",
      "target": "$data",
      "value": "[{\"type\": \"greeting\", \"lang\": \"EN\"}, {\"type\": \"farewell\", \"lang\": \"FR\"}, {\"type\": \"greeting\", \"lang\": \"JP\"}]",
      "next": "Loop_Process"
    },
    {
      "id": "Loop_Process",
      "mode": "serial",
      "source": "=$data",
      "children": ["Branch_Type"],
      "next": "Stop_End"
    },
    {
      "id": "Branch_Type",
      "cases": [
        ["=_item.type == \"greeting\"", "LLM_Greeting"],
        ["ELSE",                        "LLM_Farewell"]
      ],
      "next": "RETURN"
    },
    {
      "id": "LLM_Greeting",
      "in": { "messages": [{ "role": "user", "content": "=\"Say hello in \" + _item.lang + \" in exactly 3 words.\"" }] },
      "out": { "$results[_index]": "=_result" },
      "next": "RETURN"
    },
    {
      "id": "LLM_Farewell",
      "in": { "messages": [{ "role": "user", "content": "=\"Say goodbye in \" + _item.lang + \" in exactly 3 words.\"" }] },
      "out": { "$results[_index]": "=_result" },
      "next": "RETURN"
    },
    { "id": "Stop_End" }
  ]
}
