{
  "name": "Project: Sentiment Analysis",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        -48,
        0
      ],
      "id": "b243914d-8132-419f-83ad-9eb3ff728a37",
      "name": "When chat message received",
      "webhookId": "75e2987b-b36f-4ad6-9a05-3544731aae5a"
    },
    {
      "parameters": {
        "operation": "getAll",
        "subreddit": "ArtificialInteligence",
        "limit": 20,
        "filters": {}
      },
      "type": "n8n-nodes-base.reddit",
      "typeVersion": 1,
      "position": [
        160,
        0
      ],
      "id": "7d7ced35-68c7-4cc1-a06b-b23cf16e681e",
      "name": "Get many posts",
      "credentials": {
        "redditOAuth2Api": {
          "id": "Uy4UgYpeaEzF2A4u",
          "name": "Reddit account 2"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.data }}",
        "options": {
          "systemMessage": "=Analyse the input reddit posts. Consider the general sentiment of the posts and output an analysis of where reddit thinks AI is at this time.\n\nFinally, give a score from 0 (pessimistic) to 10 (hyper optimistic) and motivate your decision in 1 short sentence"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        688,
        0
      ],
      "id": "da00ac53-54c8-4bd2-b4c9-38654ec7dbef",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        640,
        208
      ],
      "id": "2c4ed253-0402-4092-864a-48ad2649c28d",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "xHWDVrLvQFklSodD",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "aggregate": "aggregateAllItemData",
        "options": {}
      },
      "type": "n8n-nodes-base.aggregate",
      "typeVersion": 1,
      "position": [
        416,
        -128
      ],
      "id": "311c2f97-fe0c-40ad-931f-ab2518f9eec8",
      "name": "Aggregate",
      "disabled": true
    },
    {
      "parameters": {
        "jsCode": "// Combine all input items into a single array of simplified post objects\nconst data = $input.all().map(item => {\n  return {\n    title: item.json.title,\n    selftext: item.json.selftext\n  };\n});\n\n// Return a single item containing all posts\nreturn [\n  {\n    json: {\n      data\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        416,
        80
      ],
      "id": "8dd71382-68a8-4a6e-a6dd-d86cf0be13ed",
      "name": "Code"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Get many posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many posts": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6f953409-8aab-4bcb-89d9-b1ed13207ee3",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "281c34c03b9c41f054c536eeb966e9e503918cf7f00e3bc32a5ff9cca85ca255"
  },
  "id": "qQ1hAqbc5E8XENJe",
  "tags": []
}