{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "c499b8cc-7cc8-411d-9c22-d46c7654e169",
      "name": "Mistral Upload",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        -20
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "08cbe4b7-2adc-4ea0-8dfc-af107369b1dd",
      "name": "When clicking \u2018Test workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -540,
        -20
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "965f294a-5d77-4190-ad4f-ff191aba0948",
      "name": "Mistral Signed URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        900,
        -20
      ],
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "24"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7abfb1f8-f6c8-4fd0-a78e-9d4b97a4d6bc",
      "name": "Import PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        480,
        -20
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "15BcE6nXto9lQDHPmwjm7y9JPerAVEutY"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "8942c6bf-4d86-4a95-aa4a-c819008e2534",
      "name": "Import Image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        480,
        200
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "1a2FcRDWHHncMO8CYxD80uNUBGH1Sy1k2"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "94a1c3ca-1ca7-4bb1-9e7c-8314742423ab",
      "name": "Mistral Upload1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        700,
        200
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "purpose",
              "value": "ocr"
            },
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9d075eec-ba0e-41e1-8bdc-a732bc0f9229",
      "name": "Mistral Signed URL1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        900,
        200
      ],
      "parameters": {
        "url": "=https://api.mistral.ai/v1/files/{{ $json.id }}/url",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "queryParameters": {
          "parameters": [
            {
              "name": "expiry",
              "value": "24"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f623f066-fc70-40fa-b608-f28a75a8ac8c",
      "name": "Mistral DOC OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        -20
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"document_url\",\n    \"document_url\": \"{{ $json.url }}\"\n  },\n  \"include_image_base64\": true\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "15913796-e7c8-451a-8e7b-da7a3b10db02",
      "name": "Mistral IMAGE OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1100,
        200
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"image_url\",\n    \"image_url\": \"{{ $json.url }}\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "a79524ff-84f0-46db-bb8e-afc18f1ddd40",
      "name": "Document URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1eb5f18b-eb06-48df-8491-d60de75b4855",
              "name": "url",
              "type": "string",
              "value": "=https://pub-d4aa9be14ae34d6ebcebe06f13af667b.r2.dev/multimodal_bank_statement_scan.pdf"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "72b89f33-a67c-4f73-9a78-e8ccd02fbc98",
      "name": "Image URL",
      "type": "n8n-nodes-base.set",
      "position": [
        -160,
        200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1eb5f18b-eb06-48df-8491-d60de75b4855",
              "name": "url",
              "type": "string",
              "value": "=https://pub-d4aa9be14ae34d6ebcebe06f13af667b.r2.dev/multimodal_bank_statement_2.png"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "808ccbb3-0dae-4e2c-9166-bf40c589824a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 580,
        "content": "### \uc608\uc81c 1. \uacf5\uac1c \ud638\uc2a4\ud305 \ud30c\uc77c  \nMistral OCR\uc744 \uc0ac\uc6a9\ud558\ub294 \uae30\ubcf8 \ubc29\ubc95\uc740 \ucc98\ub9ac\ud558\uace0 \uc2f6\uc740 \ud30c\uc77c\uc758 \uacf5\uac1c URL\uc744 \uc81c\uacf5\ud558\ub294 \uac83\uc785\ub2c8\ub2e4. \uc790\uc2e0\uc758 \ubc18(\u534a)\uac1c\uc778 \ubb38\uc11c\ub098 \ub2e4\ub978 \uc0ac\ub78c\ub4e4\uc758 \ubb38\uc11c\uc5d0 \uc801\ud569\ud569\ub2c8\ub2e4. \uac1c\uc778 \uc815\ubcf4 \ubcf4\ud638 \ubb38\uc81c\ub85c \uc778\ud574 \ud30c\uc77c\uc744 \ub178\ucd9c\uc2dc\ud0a4\uace0 \uc2f6\uc9c0 \uc54a\ub2e4\uba74, \uc608\uc81c 2\ub97c \ud655\uc778\ud558\uc138\uc694."
      },
      "typeVersion": 1
    },
    {
      "id": "b968d6ab-9582-495d-84af-f75833701e2a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 920,
        "height": 560,
        "content": "### \uc608\uc81c 2. Mistral Cloud\ub97c \ud1b5\ud574 \uac1c\uc778\uc801\uc73c\ub85c \ud638\uc2a4\ud305\n\uba3c\uc800 \ud30c\uc77c\uc744 Mistral \ud074\ub77c\uc6b0\ub4dc\uc5d0 \uc5c5\ub85c\ub4dc\ud558\uc5ec Mistral OCR\uc774 \ud30c\uc77c\uc5d0 \ub300\ud55c \uc548\uc804\ud558\uace0 \uac1c\uc778\uc801\uc778 \uc561\uc138\uc2a4 \uad8c\ud55c\uc744 \ubd80\uc5ec\ud558\uc138\uc694. \uc11c\uba85\ub41c URL\uc744 \uc0ac\uc6a9\ud558\uc5ec \ud30c\uc77c\uc744 \uac80\uc0c9\ud55c \ud6c4 \uc774\ub97c Mistral OCR\uc5d0 \uc804\ub2ec\ud558\uc138\uc694. Mistral\uc744 \ud1b5\ud574 \uc800\uc7a5\ud558\ub294 \uc774\uc810\uc740 \ubc18\ubcf5\ub418\ub294 \ubb38\uc11c\uc5d0 \ub300\ud55c \ub354 \ube60\ub978 \uce90\uc2dc \uc561\uc138\uc2a4\uc640 \uac10\uc18c\ub41c \uc9c0\uc5f0 \uc2dc\uac04\uc77c \uc218 \uc788\uc2b5\ub2c8\ub2e4."
      },
      "typeVersion": 1
    },
    {
      "id": "f2c0b30a-49be-4850-b102-f23d0feac0ec",
      "name": "Mistral DOC OCR1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        -20
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"document_url\",\n    \"document_url\": \"{{ $json.url }}\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "64a28537-e70b-48bc-b580-cc9d5a5a1b80",
      "name": "Mistral IMAGE OCR1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        200
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/ocr",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-ocr-latest\",\n  \"document\": {\n    \"type\": \"image_url\",\n    \"image_url\": \"{{ $json.url }}\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3caaa30b-21f2-4643-93dd-8dff6f3c1920",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -740,
        -440
      ],
      "parameters": {
        "width": 380,
        "height": 640,
        "content": "## Mistral OCR\uc744 \uc0ac\uc6a9\ud55c \ubb38\uc11c \ud30c\uc2f1\nMistral\uc758 \ucd5c\uc2e0 \ub9b4\ub9ac\uc2a4\uc778 **Mistral-OCR**\uc73c\ub85c \uad6c\uc870\ud654\ub41c \ubb38\uc11c \ud30c\uc2f1\uc744 \uc5c5\uadf8\ub808\uc774\ub4dc\ud558\uc138\uc694!\n* PDF \ubc0f \uc774\ubbf8\uc9c0 \ud30c\uc77c\uc744 \ud2b9\ubcc4\ud788 \ud30c\uc2f1\ud558\ub3c4\ub85d \uc124\uacc4\ub418\uc5c8\uc2b5\ub2c8\ub2e4.\n* \uc5ec\ub7ec \ud398\uc774\uc9c0 \ubb38\uc11c\uc640 \ucd5c\ub300 10k \ud53d\uc140\uc758 \uc774\ubbf8\uc9c0\ub97c \ucc98\ub9ac\ud569\ub2c8\ub2e4.\n* \uac01 \ud398\uc774\uc9c0\ub294 \ub9c8\ud06c\ub2e4\uc6b4 \ud615\uc2dd\uc73c\ub85c\ub9cc \uc804\uc0ac\ub418\uba70, \uc77c\ubc18 \ud14d\uc2a4\ud2b8 \ucd9c\ub825\uc740 \uc5c6\uc2b5\ub2c8\ub2e4.\n* \ub180\ub77c\uc6b4 \uac00\uaca9\uc73c\ub85c \ud398\uc774\uc9c0\ub2f9 \ub2e8 $0.001!\n\n### \uc694\uad6c\uc0ac\ud56d\n* Mistral Cloud API \ud0a4\uac00 \ud544\uc694\ud569\ub2c8\ub2e4.\n* \uc774 \ud15c\ud50c\ub9bf\uc740 Mistral OCR\uc6a9 Mistral Cloud API\uc5d0\uc11c\ub9cc \uc791\ub3d9\ud569\ub2c8\ub2e4.\n\n### \ucd9c\ub825"
      },
      "typeVersion": 1
    },
    {
      "id": "bd4d0c9f-f4a6-4527-8f9d-5af90a2858c2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1360,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 680,
        "height": 580,
        "content": "\uc608\uc81c 3. \ucd94\ucd9c \ud544\uc694 \uc5c6\uc74c? \ud30c\uc77c\uacfc \uc9c1\uc811 \ub300\ud654\ud558\uc138\uc694!  \nMistral\uc774 \ud14d\uc2a4\ud2b8 \ubaa8\ub378\uc5d0 OCR \uae30\ub2a5\uc744 \ud1b5\ud569\ud560 \uc218 \uc788\uc5c8\ub358 \uac83 \uac19\uc544\uc11c \ubb38\uc11c \ubd84\ub958 \ubc0f \uac10\uc815 \ubd84\uc11d\uacfc \uac19\uc740 \uc791\uc5c5\uc744 \ub9e4\uc6b0 \ube60\ub974\uac8c \uc218\ud589\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. \ubd88\ud589\ud788\ub3c4, \uc774\ubbf8\uc9c0\uc5d0\uc11c\ub294 \ub3d9\uc77c\ud558\uac8c \uc791\ub3d9\ud558\uc9c0 \uc54a\uc2b5\ub2c8\ub2e4 - Pixtral\uc744 \uc0ac\uc6a9\ud574\uc57c \ud558\uc9c0\ub9cc \uacb0\uacfc\uac00 \uc815\ub9d0 \ub098\uc069\ub2c8\ub2e4!"
      },
      "typeVersion": 1
    },
    {
      "id": "c9a9d4bb-4ee6-413a-9f08-97fdcee22bf2",
      "name": "Document URL1",
      "type": "n8n-nodes-base.set",
      "position": [
        1520,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1eb5f18b-eb06-48df-8491-d60de75b4855",
              "name": "url",
              "type": "string",
              "value": "=https://pub-d4aa9be14ae34d6ebcebe06f13af667b.r2.dev/multimodal_bank_statement_scan.pdf"
            },
            {
              "id": "c639fce3-6967-444d-be18-6c9ce802ef22",
              "name": "query",
              "type": "string",
              "value": "what is the total number of deposits?"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5de4d62c-af8f-4e6d-adbd-2f591a2165f7",
      "name": "Document Understanding",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1740,
        -20
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"mistral-small-latest\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"{{ $json.query }}\"\n        },\n        {\n          \"type\": \"document_url\",\n          \"document_url\": \"{{ $json.url }}\"\n        }\n      ]\n    }\n  ],\n  \"document_image_limit\": 8,\n  \"document_page_limit\": 64\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9a7bbff0-d446-469d-aa61-838e8c025ad5",
      "name": "Image URL1",
      "type": "n8n-nodes-base.set",
      "position": [
        1520,
        200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1eb5f18b-eb06-48df-8491-d60de75b4855",
              "name": "url",
              "type": "string",
              "value": "=https://pub-d4aa9be14ae34d6ebcebe06f13af667b.r2.dev/multimodal_bank_statement_2.png"
            },
            {
              "id": "639cd062-ebef-44ab-97a2-79ee388f8b41",
              "name": "query",
              "type": "string",
              "value": "what is the total number of deposits?"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ca43d437-a373-4938-a0a8-8087a98d46a8",
      "name": "Document Mis-Understanding?",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1740,
        200
      ],
      "parameters": {
        "url": "https://api.mistral.ai/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"pixtral-large-latest\",\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"{{ $json.query }}\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": \"{{ $json.url }}\"\n        }\n      ]\n    }\n  ],\n  \"document_image_limit\": 8,\n  \"document_page_limit\": 64\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "mistralCloudApi"
      },
      "credentials": {
        "mistralCloudApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "connections": {
    "Image URL": {
      "main": [
        [
          {
            "node": "Mistral IMAGE OCR1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image URL1": {
      "main": [
        [
          {
            "node": "Document Mis-Understanding?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Import PDF": {
      "main": [
        [
          {
            "node": "Mistral Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Import Image": {
      "main": [
        [
          {
            "node": "Mistral Upload1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document URL1": {
      "main": [
        [
          {
            "node": "Document Understanding",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload": {
      "main": [
        [
          {
            "node": "Mistral Signed URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Upload1": {
      "main": [
        [
          {
            "node": "Mistral Signed URL1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral DOC OCR1": {
      "main": [
        []
      ]
    },
    "Mistral Signed URL": {
      "main": [
        [
          {
            "node": "Mistral DOC OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mistral Signed URL1": {
      "main": [
        [
          {
            "node": "Mistral IMAGE OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Test workflow\u2019": {
      "main": [
        [
          {
            "node": "Document URL",
            "type": "main",
            "index": 0
          },
          {
            "node": "Image URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}