{
  "nodes": [
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=Re\u00e7ois un texte en fran\u00e7ais (argumentatif ou liste d\u2019arguments).\n\nG\u00e9n\u00e8re un titre r\u00e9sumant le th\u00e8me.\n\nExtrait le vocabulaire essentiel pour argumenter sur ce sujet et ajoute du vocabulaire pertinent.\n\nPour chaque mot important, fournis une d\u00e9finition simple adapt\u00e9e \u00e0 un \u00e9tudiant avanc\u00e9 de fran\u00e7ais.\n\nCr\u00e9e 10 phrases courtes (\u22645 secondes \u00e0 r\u00e9p\u00e9ter) en utilisant ce vocabulaire.\n\nProduit une sortie au format suivant :\n\ntitle: titre du th\u00e8me\n\nssml: script SSML complet qui inclut :\n\nIntroduction du th\u00e8me.\n\nPr\u00e9sentation du vocabulaire avec d\u00e9finitions.\n\nExplication \u00e0 l\u2019\u00e9tudiant qu\u2019il va entendre 10 phrases et qu\u2019il doit les r\u00e9p\u00e9ter.\n\nLecture des 10 phrases avec un silence de 10 secondes apr\u00e8s chacune (<break time=\"10s\"/>).",
              "role": "system"
            },
            {
              "content": "={{ $json.text }}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -16,
        0
      ],
      "id": "2cc40799-68c8-414f-a911-d2881e7cd9e0",
      "name": "Message a model",
      "retryOnFail": false,
      "waitBetweenTries": 2000,
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "Generate French Class",
        "formFields": {
          "values": [
            {
              "fieldLabel": "text",
              "fieldType": "textarea",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -176,
        0
      ],
      "id": "f9da2b74-fa08-4630-86d8-85e23760ae3f",
      "name": "Generate French Class Form"
    },
    {
      "parameters": {
        "bucketName": "={{ $('Call Polly ID3').item.json.result.s3Location.split('/')[2] }}",
        "fileKey": "={{ $('Polly Input').item.json.key }}"
      },
      "type": "n8n-nodes-base.awsS3",
      "typeVersion": 2,
      "position": [
        528,
        224
      ],
      "id": "6dac5303-4fe5-460b-a8fc-f1524daf51af",
      "name": "Download MP3",
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "8e3bb535-e8ec-4566-9c25-d989aab6cdcd",
              "leftValue": "={{ $json.result }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        288,
        288
      ],
      "id": "1b7abddd-a1c7-4aec-b973-3069b92ae41d",
      "name": "Is Completed?"
    },
    {
      "parameters": {
        "amount": 4
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -160,
        288
      ],
      "id": "9f90e8c5-5afc-47d2-802b-c00cf86ea153",
      "name": "Wait 4s"
    },
    {
      "parameters": {
        "function": "arn:aws:lambda:us-east-1:123456789012:function:polly-id3-dev-checkTaskStatus",
        "payload": "={{ JSON.stringify({taskId:$('Call Polly ID3').item.json.result.taskId}) }}"
      },
      "type": "n8n-nodes-base.awsLambda",
      "typeVersion": 1,
      "position": [
        64,
        288
      ],
      "id": "dda9679c-cc2b-4ee9-adc9-9fdb48cb49c0",
      "name": "checkTaskStatus",
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "function": "arn:aws:lambda:us-east-1:123456789012:function:polly-id3-dev-id3",
        "payload": "={{ JSON.stringify($json, null, 2) }}"
      },
      "type": "n8n-nodes-base.awsLambda",
      "typeVersion": 1,
      "position": [
        544,
        0
      ],
      "id": "542e4cba-a950-4423-a318-0e5ce49135b1",
      "name": "Call Polly ID3",
      "retryOnFail": false,
      "waitBetweenTries": 3000,
      "credentials": {
        "aws": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3021ba5b-5392-4a84-91d8-cac7e25f8a58",
              "name": "key",
              "value": "samples/french-class-output.mp3",
              "type": "string"
            },
            {
              "id": "7360a163-2321-42e8-88db-ad05f7c0a334",
              "name": "text",
              "value": "={{ $json.message.content.ssml }}",
              "type": "string"
            },
            {
              "id": "7bde97f7-975d-4c83-ab61-57684825b95d",
              "name": "languageCode",
              "value": "fr-FR",
              "type": "string"
            },
            {
              "id": "dcdfa5d3-e1db-4f15-8fe7-6a6c191160f3",
              "name": "voiceId",
              "value": "Lea",
              "type": "string"
            },
            {
              "id": "983722cf-0ca6-4ab4-8d30-5fa2bff6f237",
              "name": "engine",
              "value": "standard",
              "type": "string"
            },
            {
              "id": "38b752a3-5d92-4a94-bffd-ce653d112f1e",
              "name": "override",
              "value": true,
              "type": "boolean"
            },
            {
              "id": "f5b24157-ac1e-4559-8b13-f095ab3536ff",
              "name": "id3",
              "value": "={{ \n{\n  \"title\": $json.message.content.title,\n  \"artist\": \"Amazon Polly\",\n  \"album\": \"Samples Polly-ID3\",\n  \"year\": new Date().getFullYear(),\n  \"genre\": \"Development\",\n  \"artwork\": \"https://img.pokemondb.net/artwork/bulbasaur.jpg\",\n  \"track\": \"1\"\n}\n}}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        352,
        0
      ],
      "id": "1acde1b3-5a43-42fb-b707-17e6dea0f39b",
      "name": "Polly Input"
    },
    {
      "parameters": {
        "amount": 4
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        528,
        416
      ],
      "id": "5c0013ed-1ad9-4aae-95ea-02ceae0186de",
      "name": "Wait 4s1"
    }
  ],
  "connections": {
    "Message a model": {
      "main": [
        [
          {
            "node": "Polly Input",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Generate French Class Form": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Completed?": {
      "main": [
        [
          {
            "node": "Download MP3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 4s1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 4s": {
      "main": [
        [
          {
            "node": "checkTaskStatus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "checkTaskStatus": {
      "main": [
        [
          {
            "node": "Is Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call Polly ID3": {
      "main": [
        [
          {
            "node": "Wait 4s",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Polly Input": {
      "main": [
        [
          {
            "node": "Call Polly ID3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 4s1": {
      "main": [
        [
          {
            "node": "checkTaskStatus",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": true
  }
}