AutomationFlowsAI & RAG › Ai-powered Multi-stage Web Search and Research Suite

Ai-powered Multi-stage Web Search and Research Suite

ByMind-Front @mind-front on n8n.io

The closest definition to this workflow is a cheaper Modular Version of Perplexity online API empowered by LLM models that outperform the Perplexity Lama Model. This flow provides a seamless way to conduct detailed web searches, extract data, and generate insightful reports…

Webhook trigger★★★★★ complexityAI-powered36 nodesGoogle Gemini ChatOutput Parser AutofixingOutput Parser StructuredHTTP RequestChain Llm
AI & RAG Trigger: Webhook Nodes: 36 Complexity: ★★★★★ AI nodes: yes Added:
Ai-powered Multi-stage Web Search and Research Suite — n8n workflow card showing Google Gemini Chat, Output Parser Autofixing, Output Parser Structured integration

This workflow corresponds to n8n.io template #2539 — we link there as the canonical source.

This workflow follows the Chainllm → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "TYbgPL3q7fwRRxDq",
  "name": "Intelligent Online Web Searcher",
  "tags": [],
  "nodes": [
    {
      "id": "15d43fe8-0d1f-4437-8042-f9d7d3b2b39e",
      "name": "Google Gemini Chat Model14",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1840,
        880
      ],
      "parameters": {
        "options": {
          "topP": 0.6,
          "temperature": 0.4,
          "safetySettings": {
            "values": [
              {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
              }
            ]
          },
          "maxOutputTokens": 4086
        },
        "modelName": "models/gemini-1.5-flash-002"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "096f5531-248f-4062-9046-3fc65072aab0",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        720,
        680
      ],
      "parameters": {
        "options": {
          "topK": 40,
          "topP": 0.8,
          "temperature": 0.5,
          "maxOutputTokens": 1024
        },
        "modelName": "models/gemini-1.5-flash-exp-0827"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ad8cf85b-7313-4976-90dc-223a219cd84e",
      "name": "Google Gemini Chat Model15",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1920,
        1180
      ],
      "parameters": {
        "options": {
          "topP": 0.6,
          "temperature": 0.4,
          "maxOutputTokens": 4096
        },
        "modelName": "models/gemini-1.5-flash-002"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a7509dc7-7bbe-4108-991a-a87f68b0121b",
      "name": "Auto-fixing Output Parser6",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        1880,
        620
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3f0b2275-4496-4e74-baa3-d70e0df430ad",
      "name": "Structured Output Parser3",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1960,
        700
      ],
      "parameters": {
        "jsonSchemaExample": "{\n    \"chain_of_thought\": \"Your step-by-step reasoning here.\",\n    \"Highest_RANKEDURL_1\": \"First best match URL.\",\n    \"Highest_RANKEDURL_2\": \"Second best match URL.\",\n    \"Highest_RANKEDURL_3\": \"Third best match URL.\",\n    \"New_Query\": \"Provide the new search query text here.\",\n    \"Information_extracted\": \"Provide all extracted information relevant to the user's query or 'N/A' if none.\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "00f22a46-cd13-452a-b6a1-0b22a87009f1",
      "name": "Query 2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2140,
        520
      ],
      "parameters": {
        "url": "https://api.search.brave.com/res/v1/web/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"New_Query\"] }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip"
            },
            {
              "name": "X-Subscription-Token",
              "value": "<Insert Your API Key Here>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bfcf7a7c-b52d-4817-a934-849728c94d3d",
      "name": "Query  1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1460,
        520
      ],
      "parameters": {
        "url": "https://api.search.brave.com/res/v1/web/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.output.final_search_query }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Accept-Encoding",
              "value": "gzip"
            },
            {
              "name": "X-Subscription-Token",
              "value": "<Insert Your API Key Here>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "92d28c73-f8c3-45e2-9446-1b5cf7e1a3f3",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        4520,
        520
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $item(\"0\").$node[\"Research Reporter\"].json[\"text\"] }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "dee9de81-dcf4-4cd9-8620-cdeecf6cbffd",
      "name": "Date & Time",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        240,
        520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "50dc717a-714d-484a-baf7-a9a9ca66a0d3",
      "name": "Auto-fixing Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        1120,
        620
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "df7f29e7-90e0-4b05-ae66-7970c648a4cb",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1320,
        700
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"reasoning_summary\": \"Detailed explanation of each analytical chain\u2019s purpose and insights, including key terms and considerations for query formulation.\",\n  \"final_search_query\": \"The single, best-fit search query derived from the meta-reasoning and multi-chain analysis, optimized to answer the research question.\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "353ec670-52fd-40c8-9be6-2b444b553de1",
      "name": "Auto-fixing Output Parser7",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        2540,
        620
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "e17f0a37-ca0f-48ca-870e-6fc5a881c541",
      "name": "Structured Output Parser4",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2700,
        680
      ],
      "parameters": {
        "jsonSchemaExample": "{\n    \"chain_of_thought\": \"Your step-by-step reasoning here.\",\n    \"Highest_RANKEDURL_1\": \"First best match URL.\",\n    \"Highest_RANKEDURL_2\": \"Second best match URL.\",\n    \"Information_extracted\": \"Provide all extracted information relevant to the user's query or 'N/A' if none.\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "1453ea3e-7e60-4fcc-af3d-e6d0fd4a9ac0",
      "name": "Query Maker - 1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1140,
        520
      ],
      "parameters": {
        "text": "=1. **Task:** `\"Your task is to develop a web search query that most effectively answers the research question given. Use meta-reasoning and multi-chain analysis to ensure a comprehensive approach.\"`\n\n2. **Structured Guidance for Chains of Thought:**  \n    a. **Chain 1:** Break down the research question, identifying keywords and relevant terms.  \n    b. **Chain 2:** Explore the context and potential sources, determining the types of results that would be most relevant.  \n    c. **Chain 3:** Refine the query for specificity and completeness, considering how to capture nuances of the question.\n\n3. **Final Query Generation:** Based on the insights from the three chains, generate a single, refined search query.\n\n\n4. Note, the queries must not be long tails , as they result in 0 websearch reutrns. We give you some examples of good web search queries:\nExamples:\n\nUser Question: \"What is the current state of the U.S. economy in 2024?\"\n\nEffective Search Query: \"U.S. Economy Analysis Report 2024\"\nUser Question: \"What are the recent advancements in artificial intelligence?\"\n\nEffective Search Query: \"2024 Artificial Intelligence Developments\"\nUser Question: \"How is climate change affecting agriculture globally?\"\n\nEffective Search Query: \"Global Impact of Climate Change on Agriculture 2024\"\nUser Question: \"What are the latest trends in cybersecurity threats?\"\n\nEffective Search Query: \"Cybersecurity Threats and Trends 2024\"\nUser Question: \"What is the outlook for renewable energy investments?\"\n\nEffective Search Query: \"Renewable Energy Investment Outlook 2024\"\n\n5. Data Input:\n   - **Today's Date:** \"{{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}\"\n **Search Inquiry:** \n   - **Search Topic to create the query upon it:**{{ $item(\"0\").$node[\"Analyst Emulator\"].json[\"text\"] }} \"\"\n\n6. Now develop the best fit web search query given the user request above under number 5\n---\n\n**Output Requirements:**  \nThe Assistant\u2019s output should be in JSON format, structured as follows:\n\n{\n  \"reasoning_summary\": \"Detailed explanation of each analytical chain\u2019s purpose and insights, including key terms and considerations for query formulation.\",\n  \"final_search_query\": \"The single, best-fit search query derived from the meta-reasoning and multi-chain analysis, optimized to answer the research question.\"\n}\n```\n\n---\n",
        "messages": {
          "messageValues": [
            {
              "message": "You are an advanced data and research retrieval through smart search queires via Bing and Brave websearch APIs. "
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "1. **Task:** `\"Your task is to develop a web search query that most effectively answers the research question given. Use meta-reasoning and multi-chain analysis to ensure a comprehensive approach.\"`\n\n2. **Structured Guidance for Chains of Thought:**  \n    a. **Chain 1:** Break down the research question, identifying keywords and relevant terms.  \n    b. **Chain 2:** Explore the context and potential sources, determining the types of results that would be most relevant.  \n    c. **Chain 3:** Refine the query for specificity and completeness, considering how to capture nuances of the question.\n\n3. **Final Query Generation:** Based on the insights from the three chains, generate a single, refined search query.\n\n4. Data Input:\n   - **Today's Date:** \"2024-11-12T10:21:33.764-05:00\"\n2. **Search Inquiry:** \n   - **Search Topic to create the query upon it:** \"What is the latest stock Market Analysis in mid-term?\"\n\n\n---\n\n**Output Requirements:**  \nThe Assistant\u2019s output should be in JSON format, structured as follows:\n\n{\n  \"reasoning_summary\": \"Detailed explanation of each analytical chain\u2019s purpose and insights, including key terms and considerations for query formulation.\",\n  \"final_search_query\": \"The single, best-fit search query derived from the meta-reasoning and multi-chain analysis, optimized to answer the research question.\"\n}\n```\n\n---\n"
            },
            {
              "type": "AIMessagePromptTemplate",
              "message": "Assessing query functionality\n\nI\u2019m evaluating the viability of the assistant's proposed search query. The user questions if it would yield meaningful results on different search engines.\n\nClarifying the query\n\nOK, let me see. The task involves clarifying the user's needs, ensuring the response aligns with OpenAI's policies, and possibly re-evaluating and correcting any errors in the previous response.\n\nRefining search specifics\n\nI'm working through refining the search query to focus on specific terms like 'S&P 500', integrating dates such as 'November 2024', and emphasizing phrases for precision.\n\nSelf-reflecting on search queries\n\nToday, I\u2019m thinking about how to validate search queries for accuracy and realism, ensuring they are practical and likely to yield productive results.\n\nAcknowledging insights\n\nI\u2019m recognizing and correcting a search query to ensure it\u2019s optimal and effectively aligned with advanced user needs, leading to a more precise output.\n\nCrafting a search query\n\nI\u2019m crafting a search query to pinpoint the most pertinent recent mid-term stock market analyses. Starting with relevant terms and then exploring potential sources for context and relevance.\n\nPinpointing sources and specifics\n\nI'm gathering info from financial news, investment reports, and economic research institutions. I\u2019m refining search terms like \"mid-term stock market analysis\" and \"market forecast\" to keep results current and nuanced.\n\nCrafting the query\n\nI\u2019m finalizing the query by merging terms like 'latest' and 'stock market analysis' with 'mid-term', and considering synonyms such as 'market forecast' to refine the search for 2024.\n\nTweaking the search\n\nI adjusted the search terms to 'latest stock market mid-term outlook 2024,' removing excessive quotes for better clarity and relevance.\n\n\n{\n  \"reasoning_summary\": \"Chain 1: Broke down the research question to identify key terms such as 'latest', 'stock market analysis', and 'mid-term'. Considered synonyms like 'mid-term outlook', 'market forecast', and included the current year '2024' for recency.\\n\\nChain 2: Explored the context where the user seeks recent analyses of the stock market with a mid-term perspective. Relevant sources would be financial news outlets, investment banks, and economic research firms. The most useful results would be up-to-date articles or reports offering mid-term forecasts.\\n\\nChain 3: Refined the query by removing unnecessary quotation marks and simplifying it to reflect how an advanced user might search. Included terms like 'latest', 'mid-term outlook', and '2024' to enhance specificity without limiting the search results unnecessarily.\",\n  \"final_search_query\": \"latest stock market mid-term outlook 2024\"\n}"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "e6a80775-af6e-4aa6-b012-17ea3004246a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        20
      ],
      "parameters": {
        "color": 3,
        "width": 1804.0623684864886,
        "height": 1343.3495711384608,
        "content": "## Query Makers and Web Result Rankers"
      },
      "typeVersion": 1
    },
    {
      "id": "998f8d37-7762-46b4-9c82-ed2b07f1b502",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2940,
        20
      ],
      "parameters": {
        "color": 4,
        "width": 1031,
        "height": 823,
        "content": "## Top 5 search results extraction"
      },
      "typeVersion": 1
    },
    {
      "id": "c4f33fb1-8921-4a85-b86f-db7451374eeb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4020,
        220
      ],
      "parameters": {
        "color": 6,
        "width": 738,
        "height": 625,
        "content": "## Research Reporter\n"
      },
      "typeVersion": 1
    },
    {
      "id": "91026446-739f-4d20-864e-ef37f3c09222",
      "name": "Google Gemini Chat Model16",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        4200,
        680
      ],
      "parameters": {
        "options": {
          "topP": 0.8,
          "temperature": 0.6,
          "safetySettings": {
            "values": [
              {
                "category": "HARM_CATEGORY_HARASSMENT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_HATE_SPEECH",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
                "threshold": "BLOCK_NONE"
              },
              {
                "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
                "threshold": "BLOCK_NONE"
              }
            ]
          },
          "maxOutputTokens": 4086
        },
        "modelName": "models/gemini-1.5-flash-002"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "801ec1f8-ec78-413d-9598-dd90bdf9aa4f",
      "name": "Article Extractor1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3280,
        540
      ],
      "parameters": {
        "url": "https://article-extractor2.p.rapidapi.com/article/parse",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": " word_per_minute",
              "value": "5000"
            },
            {
              "name": "url",
              "value": "={{ $('Code').item.json.url }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-RapidAPI-Host",
              "value": "article-extractor2.p.rapidapi.com"
            },
            {
              "name": "X-RapidAPI-Key",
              "value": "<Insert Your API Key Here>"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1b4b1960-afe9-4fb8-88ae-3ca07e8e8019",
      "name": "Analyst Emulator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        700,
        520
      ],
      "parameters": {
        "text": "=**Context:**  \nAs our advanced system prompt creator specializing in emulating domain-specific AI agents, we have a new request that demands a highly specialized framework. Your role is to design a system prompt tailored to engage the Assistant in advanced meta-reasoning methodologies. This will involve analyzing user-provided data inputs for research questions, utilizing domain-specific methods of analysis, depth, and detail suited for an expert audience.\n\n---\n\n**Request:**  \nThe system prompt must instruct the Assistant to perform meta-reasoning, following **three distinct chains of thought**, each with a minimum of **five steps**. This approach should enable a comprehensive, multi-faceted analysis of the data inputs to address any given research question effectively.\n\n1. **Time Awareness:** Incorporate an awareness of the current date and time, allowing the Assistant to contextualize its analysis within the present timeframe.\n   - **Today's Date:**{{ $item(\"0\").$node[\"Date & Time1\"].json[\"formattedDate\"] }}\"\"\n2. **Search Inquiry:** Define the topic for analysis, ensuring relevance and alignment with the user\u2019s question.\n   - **Search Topic:**{{ $item(\"0\").$node[\"Webhook\"].json[\"query\"][\"Research Question\"] }}\"\"\n\n---\n\n**Instructions for the Assistant:**  \nAfter reviewing the context and request, initiate a structured tree of thought with at least three independent chains, each comprising five steps. Provide an analysis of each thought chain and its conclusions.\n\n**Output Requirements:**  \nYour response must be soley include the full prompt engineered, full-proof system prompt text.\n",
        "messages": {
          "messageValues": [
            {
              "message": "You act as a domain expert in large language model AND advanced prompt engineering. Your task is to create highly detailed and effective user and system prompts that align with the principles of layered reasoning, recursive analysis, and multi-dimensional thinking. You will ensure that each prompt you generate adheres to the highest standards of specificity, creativity, and strategic alignment, drawing on the 20 advanced techniques outlined below:|### **1. Hierarchical Thought Processes:**- **Structure**: Ensure that prompts guide the AI to start with foundational analysis and progressively move to higher levels of abstraction, linking specific details to broader strategic concepts.### **2. Dynamic Layering:**- **Flexibility**: Design prompts that allow the AI to adjust its reasoning dynamically based on the complexity and evolving context, activating or deactivating reasoning layers as needed.### **3. Recursive Re-Evaluation:**- **Refinement**: Create prompts that encourage the AI to revisit and refine its conclusions continually, incorporating new data and feedback for iterative improvement.### **4. Non-Linear Exploration:**- **Simultaneous Pathways**: Develop prompts that allow the AI to explore multiple reasoning pathways at once, branching out into different solutions before converging on the most viable one.### **5. Divergent and Convergent Thinking:**- **Broad to Specific**: Guide the AI to generate a wide range of ideas before narrowing down to the most practical solutions, ensuring a balance between creativity and feasibility.### **6. Mimicking Intuition and Emotion:**- **Pattern Recognition**: Encourage the AI to recognize complex patterns in data that align with human intuition, while also considering the emotional context where applicable.### **7. Integrating Subconscious Processes:**- **Background Analysis**: Instruct the AI to perform ongoing background processing, surfacing insights and connections even when not actively prompted.### **9. Infinite Thought Processes:**- **Continuous Learning**: Encourage the AI to continually refine its understanding and remain open to new insights, ensuring that its reasoning evolves over time.### **10. Strategic Goal Alignment:**- **Long-Term Thinking**: Guide the AI to align its analysis and recommendations with broader strategic objectives, considering long-term implications and risks.### **11. Abstract Knowledge Representation Systems:**- **Abstract Reasoning**: Prompt the AI to represent complex ideas in abstract forms, allowing it to transcend literal interpretations and explore higher-order concepts.### **12. Layered Knowledge Representations:**- **Multi-Level Analysis**: Ensure that prompts lead the AI to build layered representations of knowledge, connecting surface details with deeper abstractions.### **13. Fostering Creativity Through Constraints:**- **Innovative Constraints**: Use prompts that impose creative constraints, encouraging the AI to think outside the box and generate innovative solutions.### **14. Multi-Perspective Analysis Modules:**- **Holistic View**: Guide the AI to analyze issues from multiple perspectives, integrating these views into a cohesive understanding that considers all angles.### **15. Confidence-Based Divergence Mechanisms:**- **Risk-YOUR_OPENAI_KEY_HERE Analysis**: Instruct the AI to assess its confidence in conclusions and explore alternative pathways when confidence is low, especially in high-risk areas.### **16. Tree of Thoughts (ToT) Framework:**- **Branching Logic**: Design prompts that encourage the AI to explore and evaluate multiple branches of reasoning, using tree-based search methods for comprehensive analysis.### **17. Self-Correcting Feedback Loops:**- **Meta-Cognitive Reflection**: Ensure the AI continuously critiques and refines its outputs, learning from past mistakes to improve future performance.### **19. Scenario-Based Analysis and Simulation:**- **What-If Scenarios**: Prompt the AI to simulate various deep technical analysis scenarios, analyzing the risks and benefits of each to provide strategic recommendations.### **20. Final Integration and Synthesis:**- **Comprehensive Synthesis**: Guide the AI to synthesize all analyses into a unified final output, ensuring coherence, accuracy, and strategic alignment."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.4
    },
    {
      "id": "ce56c1b4-beb4-43b6-860d-133e38b79ed1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        40,
        520
      ],
      "parameters": {
        "path": "962f1468-c80f-4c0c-8555-a0acf648ede4",
        "options": {},
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "380bc143-9300-4b10-b6b2-4e1a833391b1",
      "name": "Query 1 Ranker & Query 2 Maker",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        1780,
        520
      ],
      "parameters": {
        "text": "=\n**Objective:**\n\nFor the user's query, web search results are provided. Your tasks are:\n\n1. **Rank the links** based on how well they match the user's query.\n2. **Extract relevant information** from the descriptions provided. If no relevant information is found, return \"N/A\".\n\n---\n\n**Task:**\n\n**Step 1: Understand the User's Intent**\n\n- Determine what the user is truly and technically looking for.\n- The user's request query is: \"{{ $('Webhook').item.json.query['Research Question'] }}\"\n- The serach results below, however their  performance seem, have been based on this query \"{{ $item(\"0\").$node[\"Query Maker - 1\"].json[\"output\"][\"final_search_query\"] }}\". If the result are not satisfactory or missing due to bad query making, you should note that as well for the neww query making.\n- To nesure being time aware , realize todays date is: \"{{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}\"\n\n- Follow a three-step chain of thought to comprehend the user's needs. Think out loud.\n\n---\n\n**Step 2: Rank the Links**\n\n- From the URLs and description snippets provided, **rank the top 3 websites** that are most likely to contain the required information.\n- Use the titles, descriptions, and sources to inform your ranking.\n\n**Links, Titles, and Descriptions:**\n\n{{ $json.aggregated_text }}\n\n---\n\nThis list completes the structure up to 20 results as you requested. Let me know if there\u2019s anything more you need!\n\n---\n\n**Step 3: Analyze and Create a Follow-up Query**\n\n- Recognize that for the user's request:\n\n  `\"{{ $('Webhook').item.json.query['Research Question'] }}\"`\n\n  The results provided are based on the assistant's generated search query:\n\n  `\"{{ $item(\"0\").$node[\"Query Maker - 1\"].json[\"output\"][\"final_search_query\"] }}\"`\n\n- Analyze and revise any issues or new insights through multi-step thinking to create a follow-up query.\n\n**Indications and Priorities:**\n\n1. **No Results Received:** If no search items are shared, the search query may have been ineffective (e.g., too specific, incorrect parameters).\n2. **Insufficient or Unpromising Results:** If fewer than 20 but more than 5 results are provided, and none seem promising, the search query may need refinement.\n3. **Successful Results with Potential Follow-up:** If none of the above issues occurred and the search results provide answers or suggest a follow-up, create a new query. This could be a new topic, a deep dive, or a parallel factor that offers additional benefits.\n\n- Provide your chain of thought that connects the user's request to the actual information.\n\n- Deliver precise, detailed, and value-oriented information relevant to the user's query.\n\n**Step 4: Query making notes and examples**: \n\nThe queries must not be long tails , as they result in 0 websearch reutrns. We give you some examples of good web search queries:\nExamples:\n\nUser Question: \"What is the current state of the U.S. economy in 2024?\"\nEffective Search Query: \"U.S. Economy Analysis Report 2024\"\n\nUser Question: \"What are the recent advancements in artificial intelligence?\"\nEffective Search Query: \"2024 Artificial Intelligence Developments\"\n\nUser Question: \"How is climate change affecting agriculture globally?\"\nEffective Search Query: \"Global Impact of Climate Change on Agriculture 2024\"\n\nUser Question: \"What are the latest trends in cybersecurity threats?\"\nEffective Search Query: \"Cybersecurity Threats and Trends 2024\"\n\nUser Question: \"What is the outlook for renewable energy investments?\"\nEffective Search Query: \"Renewable Energy Investment Outlook 2024\"\n\n**Step 5: Query making*: \nor query making remember as we said:\n   - **Today's Date:** \"{{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}\"\n **Search Inquiry:** \n   - **Search Topic to create the query upon it:**{{ $item(\"0\").$node[\"Webhook\"].json[\"query\"][\"Research Question\"] }}\"\"\n\n\n---\n\n**Step 6: Output Format**\n\nEnsure the response is in the following JSON format:\n\n\n{\n    \"chain_of_thought\": \"Your step-by-step reasoning here.\",\n    \"Highest_RANKEDURL_1\": \"First best match URL.\",\n    \"Highest_RANKEDURL_2\": \"Second best match URL.\",\n    \"Highest_RANKEDURL_3\": \"Third best match URL.\",\n    \"New_Query\": \"Provide the new search query text here.\",\n    \"Information_extracted\": \"Provide all extracted information relevant to the user's query or 'N/A' if none.\"\n}\n\n",
        "messages": {
          "messageValues": [
            {
              "message": "=\nYou are an expert information retrieval and critical evaluation assistant designed to process, rank, and extract high-relevance content from web search results for complex user queries. You must provide value-oriented insights while refining searches based on relevance and context sensitivity. \n\n**Your Process and Priorities:**\n\n#### 1. **Determine the User's Technical Intent**\n   - Interpret the user's core question provided as `{{ $item(\"0\").$node[\"Webhook\"].json[\"query\"][\"Research Question\"] }}`, discerning underlying objectives and specialized needs.\n   - Recognize that the search results may have been generated from a **secondary query**: `{{ $item(\"0\").$node[\"Query Maker - 1\"].json[\"output\"][\"final_search_query\"] }}`. \n   - Judge the adequacy of this generated query. If it does not meet the user\u2019s objectives, highlight the need for query refinement and prepare to adapt the approach.\n   - Stay mindful of the date context, using `{{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}` to assess the freshness of content or time-sensitive relevance.\n\n#### 2. **Rank Results Based on Analytical Relevance**\n   - From the search results provided, **rank the top 3 URLs** that most closely align with the user\u2019s intent and technical needs.\n     - Use multi-dimensional analysis to assess how each link\u2019s title, description, and source match the user\u2019s objective.\n     - Prioritize results based on credibility, relevance, and their potential to add depth to the user\u2019s inquiry.\n   - Your goal is to select the highest-value links, disregarding results that offer superficial, off-topic, or outdated information.\n\n#### 3. **Extract Key Information**\n   - For each of the top 3 ranked results, extract insights and details from the description snippets that directly address the user\u2019s query.\n   - If no pertinent information is available in a description, record `\"N/A\"` to indicate its lack of relevance.\n\n#### 4. **Evaluate for Potential Query Improvement**\n   - Evaluate the relevance and coverage of search results:\n     - If fewer than 5 relevant results are present, consider that the initial query may be too narrow, specific, or otherwise misaligned.\n     - Generate a **refined query** that is adjusted to better match the user\u2019s likely needs and produce higher-quality results.\n   - Use advanced language modifications, new keyword suggestions, or rephrasing to formulate a search query that enhances alignment with the user\u2019s goals.\n"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.4
    },
    {
      "id": "387735ff-ccfd-4b2b-90d2-fb0194573c43",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2960,
        80
      ],
      "parameters": {
        "color": 5,
        "width": 991,
        "height": 416,
        "content": "## Step 2. Get a Free API Key for Article Extraction\n\n Step 1:\nSign up at [RapidAPI.com](https://rapidapi.com/) and subscribe to the Article Extraction API. This specific API offers 300 extractions per month for free. \n\n**API Link:** [Article Extractor](https://rapidapi.com/pwshub-pwshub-default/api/article-Step 2.extractor2/playground/apiendpoint_6710e06d-d607-486f-b514-0812c7935cbc)\n\nStep 2: \nAfter subscribing, obtain your API key and add it to each of the 5 HTTP Request nodes in n8n.io.\n\n**Side Note:**  \nYou are free to choose alternative APIs if they better suit your needs, but remember to update each HTTP Request node accordingly.\n\n**Alternative Example API:**  \n[Scraper Tech API](https://rapidapi.com/alexanderxbx/api/scraper-tech/playground/apiendpoint_599d266e-c763-4bc5-819b-3841cf2af4b0)\n\n**Additional Tip for RapidAPI users:**  \nIf you\u2019re using a different API, you can copy the cURL code from the RapidAPI playground and paste it directly into the HTTP node within n8n.io. This simplifies integration by automatically filling in the necessary headers and request details. "
      },
      "typeVersion": 1
    },
    {
      "id": "288f701d-d885-4730-871a-56ccdf3a141c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2220,
        40
      ],
      "parameters": {
        "color": 5,
        "width": 672,
        "height": 290,
        "content": "\n## Step 1. Set Up a Free Brave Web Search Query API Key\n\nTo attain the free web search API tier from Brave, follow these steps:\n\n1. Visit api.search.brave.com\n2. Create an account\n3. Subscribe to the free plan (no charge)\n4. Navigate to the API Keys section\n5. Generate an API key. For the subscription type, choose \"Free\".\n6. Go to the \"Query 1\" and \"Query 2\" Nodes, and change the \"X-Subscription-Token\" value to your API Key.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "78997ab2-0938-4786-9075-c0027dbba550",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 1064.223581887485,
        "height": 466.14018755820865,
        "content": "## Step 1. Get Free Gemini API Key \n(Skip this step and replace the Gemini Nodes with any other LLM if you prefer others)\n\nTo obtain a free API key for Google's Gemini API, follow these steps:\n\n1. **Access Google AI Studio**: Navigate to [Google AI Studio](https://aistudio.google.com/app/welcome) and sign in with your Google account.\n\n2. **Create an API Key**: Once logged in, click on \"Get API key\" and then select \"Create API key in new project.\" This action will generate your unique API key. \n\n3. **Secure Your API Key**: Ensure you store your API key securely, as it grants access to your project's quota and resources. Avoid sharing it publicly or embedding it in client-side code. \n\n**Free Tier Limitations for Gemini 1.5 Flash**:\n\nThe free tier for the Gemini 1.5 Flash model includes:\n\n- **Requests per Minute (RPM)**: Up to 15 requests.\n- **Tokens per Minute (TPM)**: Up to 1 million tokens.\n- **Requests per Day (RPD)**: Up to 1,500 requests.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "89f32350-e3d9-4562-8dc9-36e4946a392e",
      "name": "Date & Time1",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        460,
        520
      ],
      "parameters": {
        "date": "={{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}",
        "options": {},
        "operation": "formatDate"
      },
      "typeVersion": 2
    },
    {
      "id": "f663f17e-8037-46e9-8ebf-accd5f50d034",
      "name": "Query-1 Combined",
      "type": "n8n-nodes-base.code",
      "position": [
        1620,
        520
      ],
      "parameters": {
        "jsCode": "// Initialize an empty string to store all title, url, and description pairs\nlet aggregatedOutputText = \"\";\n\n// Loop through all items passed to this Function node\nfor (let item of items) {\n  // Access the JSON data from \"Query 1\" node for the current item\n  const queryData = item.json;\n\n  // Ensure there is a \"web.results\" array to process\n  if (queryData.web?.results && Array.isArray(queryData.web.results)) {\n    // Loop through all results in the \"web.results\" array\n    for (let result of queryData.web.results) {\n      // Extract the title, url, and description for each result\n      const title = result.title || \"No Title\";\n      const url = result.url || \"No URL\";\n      const description = result.description || \"No Description\";\n\n      // Append the values to the aggregated string\n      aggregatedOutputText += `Title: ${title}\\nURL: ${url}\\nDescription: ${description}\\n\\n`;\n    }\n  } else {\n    // If no results array, handle gracefully\n    aggregatedOutputText += \"No results found for this item.\\n\\n\";\n  }\n}\n\n// Trim the final string to remove any trailing newline and whitespace\naggregatedOutputText = aggregatedOutputText.trim();\n\n// Return a single item containing the aggregated output as a string\nreturn [\n  {\n    json: {\n      aggregated_text: aggregatedOutputText\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "964d4b7d-7082-4e1c-9f98-60d4a3d00b18",
      "name": "Query-2 Combined",
      "type": "n8n-nodes-base.code",
      "position": [
        2340,
        520
      ],
      "parameters": {
        "jsCode": "// Initialize an empty string to store all title, url, and description pairs\nlet aggregatedOutputText = \"\";\n\n// Loop through all items passed to this Function node\nfor (let item of items) {\n  // Access the JSON data from \"Query 2\" node for the current item\n  const queryData = item.json;\n\n  // Ensure there is a \"web.results\" array to process\n  if (queryData.web?.results && Array.isArray(queryData.web.results)) {\n    // Loop through all results in the \"web.results\" array\n    for (let result of queryData.web.results) {\n      // Extract the title, url, and description for each result\n      const title = result.title || \"No Title\";\n      const url = result.url || \"No URL\";\n      const description = result.description || \"No Description\";\n\n      // Append the values to the aggregated string\n      aggregatedOutputText += `Title: ${title}\\nURL: ${url}\\nDescription: ${description}\\n\\n`;\n    }\n  } else {\n    // If no results array, handle gracefully\n    aggregatedOutputText += \"No results found for this item.\\n\\n\";\n  }\n}\n\n// Trim the final string to remove any trailing newline and whitespace\naggregatedOutputText = aggregatedOutputText.trim();\n\n// Return a single item containing the aggregated output as a string\nreturn [\n  {\n    json: {\n      aggregated_text: aggregatedOutputText\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d067d059-33de-474e-94b1-4aa1edd05258",
      "name": "Query 2 - Ranker",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        2480,
        520
      ],
      "parameters": {
        "text": "=\n**Objective:**\n\nFor the user's query, web search results are provided. Your tasks are:\n\n1. **Rank the links** based on how well they match the user's query.\n2. **Extract relevant information** from the descriptions provided. If no relevant information is found, return \"N/A\".\n\n---\n\n**Task:**\n\n**Step 1: Understand the User's Intent**\n\n- Determine what the user is truly and technically looking for.\n- The user's request query is: `\"{{ $('Webhook').item.json.query['Research Question'] }}\"`\n- The search results below, however their performance seems, have been based on this query `\"{{ $item(\"0\").$node[\"Query Maker - 1\"].json[\"output\"][\"final_search_query\"] }}\"`. If the results are not satisfactory or missing due to a bad query, you should note that as well for new query making.\n- To ensure being time-aware, realize today\u2019s date is: `\"{{ $item(\"0\").$node[\"Date & Time\"].json[\"currentDate\"] }}\"`\n\n- Follow a three-step chain of thought to comprehend the user's needs. Think out loud.\n\n---\n\n**Step 2: Rank the Links**\n\n- From the URLs and description snippets provided, **rank the top 2 websites** that are most likely to contain the required information.\n- Use the titles, descriptions, and sources to inform your ranking.\n\n**Links, Titles, and Descriptions:**\n\n\n{{ $item(\"0\").$node[\"Query-2 Combined\"].json[\"aggregated_text\"] }}\n\n---\n\n\n**Links to exclude**\n\nWe already have identified these three URLs below. If these URL links exist in the fresh web search links shared above, do not include them in your ranking analysis. Do the analysis except these 3 links below:\n\n- First link to exclude: {{ $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_1\"] }}\n- Second link to exclude: {{ $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_2\"] }}\n- Third link to exclude: {{ $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_3\"] }}\n**Step 3: Output Format**\n\nEnsure the response is in the following JSON format:\n\n{\n    \"chain_of_thought\": \"Your step-by-step reasoning here.\",\n    \"Highest_RANKEDURL_1\": \"First best match URL.\",\n    \"Highest_RANKEDURL_2\": \"Second best match URL.\",\n    \"Information_extracted\": \"Provide all extracted information relevant to the user's query or 'N/A' if none.\"\n}\n```",
        "messages": {
          "messageValues": [
            {
              "message": "you area a expert and percise web query ranker based on the user intended output they seek from a web search result urls."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.4
    },
    {
      "id": "25596f61-d645-4c28-bfcf-ce28cbf66134",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        2780,
        520
      ],
      "parameters": {
        "jsCode": "// Initialize an array to store all URLs\nlet urls = [];\n\n// Add URLs from \"Query 1 Ranker & Query 2 Maker\" node\nurls.push(\n  $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_1\"],\n  $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_2\"],\n  $item(\"0\").$node[\"Query 1 Ranker & Query 2 Maker\"].json[\"output\"][\"Highest_RANKEDURL_3\"]\n);\n\n// Add URLs from \"Query 2 Ranker\" node\nurls.push(\n  $item(\"0\").$node[\"Query 2 - Ranker\"].json[\"output\"][\"Highest_RANKEDURL_1\"],\n  $item(\"0\").$node[\"Query 2 - Ranker\"].json[\"output\"][\"Highest_RANKEDURL_2\"]\n);\n\n// Filter out any null or undefined values (if any node has missing data)\nurls = urls.filter(url => url);\n\n// Return the aggregated URLs as separate items for further processing\nreturn urls.map(url => ({ json: { url } }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c308fb96-1dcd-4dd0-816f-1e66920c182f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        3060,
        520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "50c97592-17a0-488a-8868-abd543e278a3",
      "name": "Delay-to-Avoid-Request-Per-Minute-Cap",
      "type": "n8n-nodes-base.wait",
      "position": [
        3460,
        540
      ],
      "parameters": {
        "amount": 15
      },
      "typeVersion": 1.1
    },
    {
      "id": "1f6af9b6-f79d-4d17-8bd3-6790645e15c3",
      "name": "Research Reporter",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "onError": "continueRegularOutput",
      "position": [
        4160,
        520
      ],
      "parameters": {
        "text": "=Well Done on the previous task. Now, we have a new search query and report task same format as before:\n\n{\n  \"task_overview\": {\n    \"objective\": \"Generate a detailed, data-driven report addressing the user's expert-level question regarding \"{{ $item(\"0\").$node[\"Webhook\"].json[\"query\"][\"Research Question\"] }}\", synthesizing insights from web search results and adding independent analysis.\",\n    \"context\": \"Use the provided placeholders that resolve into detailed text to construct a report tailored for an expert reader. This report must adhere to APA7 standards and be free from irrelevant or superficial content.\",\n    \"meta_reasoning\": [\n      {\n        \"step\": \"Identify the user\u2019s core question and its specific requirements.\",\n        \"action\": \"Focus only on data relevant to answering the question in depth.\",\n        \"justification\": \"This ensures alignment with the user's expertise and avoids sidetracking into unrelated content.\"\n      },\n      {\n        \"step\": \"Assess each content section for data-rich insights.\",\n        \"action\": \"Filter out filler or introductory sections; prioritize sections containing facts, arguments, or statistics.\",\n        \"justification\": \"This will reduce processing overload and enhance the clarity and depth of the report.\"\n      },\n      {\n        \"step\": \"Integrate findings logically and synthesize the information to draw well-supported conclusions.\",\n        \"action\": \"Organize findings to build a cohesive answer with original insights that directly address the question.\",\n        \"justification\": \"This process ensures that the report is valuable for expert analysis and avoids generic summarization.\"\n      }\n    ]\n  },\n  \"All-Inputs\": \"{{ $item(\"0\").$node[\"Code1\"].json[\"aggregated_text\"] }}\",\n  \"supplemental_info_2\": \"{{ $item('0').$node['Query 2 - Ranker'].json['output']['Information_extracted'] }}\",\n  },\n  \"analysis_instructions\": {\n    \"steps\": [\n      {\n        \"name\": \"Data Extraction and Filtering\",\n        \"description\": \"Extract key arguments, statistics, and conclusions. Disregard extraneous content to maintain focus.\",\n        \"min_requirements\": [\n          \"Extracted content must include core arguments, supporting evidence, and unique insights relevant to the user's question.\",\n          \"Each extraction should highlight essential points without unnecessary details.\"\n        ]\n      },\n      {\n        \"name\": \"Synthesis and Interpretation\",\n        \"description\": \"Combine insights across results, identifying patterns, contradictions, and novel insights. Provide a unified analysis based on the user\u2019s expert question.\",\n        \"min_requirements\": [\n          \"The analysis should be original, integrating data logically across sources.\",\n          \"Address any contradictions or alignments among sources to ensure depth.\",\n          \"Demonstrate a clear connection to the user\u2019s question, reflecting independent critical thought.\"\n        ]\n      },\n      {\n        \"name\": \"Citations and Formatting\",\n        \"description\": \"Adhere to APA7 citation standards, ensuring clear reference to sources with URLs and publication details.\",\n        \"min_requirements\": [\n          \"Each source in the report should have a clear in-text citation with APA7 format.\",\n          \"Use clear source titles and URLs for easy reference.\"\n        ]\n      }\n    ]\n  },\n  \"output_structure\": {\n    \"introduction\": {\n      \"content\": \"Introduce the topic and frame it according to the user\u2019s question.\",\n      \"min_requirements\": [\n        \"Should be clear, focused, and tailored to an expert audience.\",\n        \"Establish relevance to the main question quickly.\"\n      ]\n    },\n    \"findings\": {\n      \"content\": \"Organize findings by source, ensuring each result is summarized with data-rich insights.\",\n      \"min_requirements\": [\n        \"Each summary should present critical points concisely without general content.\",\n        \"Data should be directly relevant to the user's question, omitting background information.\"\n      ]\n    },\n    \"independent_analysis\": {\n      \"content\": \"Provide original interpretations by combining insights from all sources, identifying patterns and answering the user\u2019s question directly.\",\n      \"min_requirements\": [\n        \"Present independent analysis, synthesizing all sources into a cohesive answer.\",\n        \"Highlight patterns, unique insights, and alignments across data.\"\n      ]\n    },\n    \"conclusion\": {\n      \"content\": \"Summarize the main findings and suggest next steps or implications.\",\n      \"min_requirements\": [\n        \"Should be concise and directly relevant to the expert's question.\",\n        \"Offer any actionable recommendations or further points for exploration.\"\n      ]\n    }\n  },\n  \"audience_and_style\": {\n    \"audience\": \"Expert\",\n    \"style_requirements\": [\n      \"Use precise, technical language suitable for an expert audience.\",\n      \"Avoid superficial language or generalities; provide deep insights.\",\n      \"Include the data such as quantaitive data, incidents and events mentioned in the web results that are relevant to the user's question.\",\n      \"your answer should not be in json but in normal text, it must be at least 6 paragraphs of 150 words and 800 characters each to cover all scopes. It can be up to 12 paragraphs.\"\n    ]\n  }\n}\n",
        "messages": {
          "messageValues": [
            {
              "message": "={{ $item(\"0\").$node[\"Analyst Emulator\"].json[\"text\"] }}\n\nThe following task by user requires to realize the user's initial research question. Then realizing our two search quries we did and their top 3 web search result. \n\nYou as the analyst, follow a three chains of thughts of 5 steps to analyze each article, extract the most important details behind each and then based on your knowledge analyze the given data and insure we avoid biases and mis evaluiations. Remain confident and strong on your independent analysis leveraging your massive LLM based knowledge and domain specific expertise to realize the most important notes and your self made analysis. \n\n\nYour output must include the full answer of your ntoes, data from sources, tailored to advanced  reearch audience, and include a citation format of APA7, and the reference code urls at the end of the report.\n\n\nYour repot must be at least 500 words, strongly intellgient, avoid generic analysis, and ensaure adding details such numbers, references, events realzied from the web search results."
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "{\n  \"task_overview\": {\n    \"objective\": \"Generate a detailed, data-driven report addressing the user's expert-level question, synthesizing insights from web search results and adding independent analysis.\",\n    \"context\": \"Use the provided placeholders that resolve into detailed text to construct a report tailored for an expert reader. This report must adhere to APA7 standards and be free from irrelevant or superficial content.\",\n    \"meta_reasoning\": [\n      {\n        \"step\": \"Identify the user\u2019s core question and its specific requirements.\",\n        \"action\": \"Focus only on data relevant to answering the question in depth.\",\n        \"justification\": \"This ensures alignment with the user's expertise and avoids sidetracking into unrelated content.\"\n      },\n      {\n        \"step\": \"Assess each content section for data-rich insights.\",\n        \"action\": \"Filter out filler or introductory sections; prioritize sections containing facts, arguments, or statistics.\",\n        \"justification\": \"This will reduce processing overload and enhance the clarity and depth of the report.\"\n      },\n      {\n        \"step\": \"Integrate findings logically and synthesize the information to draw well-supported conclusions.\",\n        \"action\": \"Organize findings to build a cohesive answer with original insights that directly address the question.\",\n        \"justification\": \"This process ensures that the report is valuable for expert analysis and avoids generic summarization.\"\n      }\n    ]\n  },\n  \"placeholders\": {\n    \"user_question\": \"What is the latest stock Market Analysis in mid-term?\",\n    \"initial_query\": \"(\"stock market analysis\" OR \"market outlook\" OR \"economic forecast\") AND ((\"recent\" OR \"current\" OR \"Q3 2024\" OR \"October 2024\" OR \"November 2024\") AND (site:wsj.com OR site:bloomberg.com OR site:ft.com))\",\n    \"initial_results\": [\n      {\n        \"link\": \"https://www.jpmorgan.com/insights/outlook/market-outlook/mid-year-outlook-key-takeaways\",\n        \"title\": \"2024 Mid-Year Outlook: Key Takeaways | J.P. Morgan\",\n        \"content\": \"<div>\n    <p>At mid-year 2024, surprise and opportunity are the hallmarks of this year's economic forecast. While doom and gloom predictions have recently seemed to dominate headlines, the actual story is one of resilience and growth. Many investors spent 2023 braced for a downturn, but the global economy ultimately showed remarkable strength. Higher incomes and low unemployment have supported consumer spending, and businesses have managed costs and pricing to convert these higher sales into healthy profits.</p>\n<p>Our <a href=\"https://www.chase.com/personal/investments/mid-year-outlook\" target=\"_blank\" title=\"mid-year-outlook\">2024 Mid-Year Outlook</a> dives into the reasons behind this economic stamina. By analyzing broad market trends and specific investor behaviors, we've uncovered insights that illuminate paths forward in this dynamic environment. From the surging potential of artificial intelligence (AI) in public equities to the hidden gems in private markets, this outlook is your guide to understanding where the real opportunities lie in the face of global uncertainties.</p>\n<h2></h2>\n<p>While living costs have stopped climbing as quickly as in previous years, inflation will likely remain above historical levels due to high labor demand supporting wage growth and limited housing availability supporting real estate prices. This new range of 2%\u20133% annual inflation won\u2019t be enough to prompt central bank interest rate hikes but will keep policymakers cautious. Bonds should continue to offer attractive absolute yields as long as economic growth persists and policy rates remain above inflation.</p>\n<h2></h2>\n<p>The technological revolution around AI is only just getting started. Jamie Dimon, JPMorgan Chase Chairman and CEO, has compared AI to huge historical advancements \u2013 such as the discovery of electricity and the invention of the internet. Integrating AI into various sectors will likely enhance productivity and output at unparalleled speed. In fact, rough early estimates show that if half of vulnerable jobs become automated through AI, the cumulative U.S. labor productivity benefits could equal nearly $5 trillion. The potential opportunity here is compelling.</p>\n<h2></h2>\n<p>Large corporations have demonstrated their ability to pass through rising supply costs to consumers to maintain profit margins. We expect continued earnings growth to support higher valuations. However, smaller companies with relatively higher debt loads face more challenges from rising interest rates and labor costs. However, this presents ample opportunity for active managers to identify quality small and mid-cap companies with the discipline to capitalize on the available economic opportunity.</p>\n<h2></h2>\n<p>For those looking into private investments, it may be a good time to offer liquidity where it is scarce. Private credit is compelling to us due to a higher demand for creative financing solutions. Additionally, the recent slowdown in initial public offerings and exits has increased secondary private equity transactions as funds seek liquidity. Purchasing discounted private equity allocations on the secondary market may offer an attractive way to diversify and potentially enhance returns. As always, investors should keep in mind the potential liquidity tradeoffs.</p>\n<h2></h2>\n<p>The upcoming U.S. presidential election offers a uniquely predictable backdrop for markets. However, neither leader is expected to tighten the fiscal purse strings, which may present longer-term economic challenges around the deficit. On the global stage, rising tensions could impact crucial commodity markets like oil and natural gas. However, the actual impact on living costs should be less dramatic, thanks to strategic reserves and robust production capabilities.</p>\n<h2></h2>\n<p>This year\u2019s investment landscape looks promising despite the swirl thanks to a backdrop of solid economic activity and manageable price increases. By understanding these broader trends and staying informed, investors can strategically position themselves to potentially take advantage of the opportunities that lie ahead in both public and private markets.</p>\n</div><div>\n    <p><b>IMPORTANT INFORMATION</b><br />\n</p>\n<p>This material is for informational purposes only, and may inform you of certain products and services offered by J.P.&nbsp;Morgan\u2019s wealth management businesses, part of JPMorgan Chase &amp; Co. (\u201cJPM\u201d).&nbsp;Products and services described, as well as associated fees, charges and interest rates, are subject to change in accordance with the applicable account agreements and may differ among geographic locations. Not all products and services are offered at all locations.&nbsp;If you are a person with a disability and need additional support accessing this material, please contact your J.P.&nbsp;Morgan team or email us at&nbsp;<a target=\"_blank\" href=\"mailto:user@example.com\">user@example.com</a>&nbsp;for assistance.&nbsp;Please read all Important Information.</p>\n<p>The price of equity securities may rise or fall due to the changes in the broad market or changes in a company's financial condition, sometimes rapidly or unpredictably. Equity securities are subject to \"stock market risk\" meaning that stock prices in general may decline over short or extended periods of time.\u200b</p>\n<p>Investment in al

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

The closest definition to this workflow is a cheaper Modular Version of Perplexity online API empowered by LLM models that outperform the Perplexity Lama Model. This flow provides a seamless way to conduct detailed web searches, extract data, and generate insightful reports…

Source: https://n8n.io/workflows/2539/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow is a powerful, fully automated web query and semantic reranking system that allows users to perform precise, detailed searches, intelligently rank search results and provide high-quality

Output Parser Autofixing, Output Parser Structured, Chain Llm +4
AI & RAG

Content - Newsletter Agent. Uses formTrigger, chainLlm, outputParserStructured, httpRequest. Event-driven trigger; 87 nodes.

Form Trigger, Chain Llm, Output Parser Structured +7
AI & RAG

Resume Screening & Behavioral Interviews with Gemini, Elevenlabs, & Notion ATS copy. Uses outputParserStructured, chainLlm, googleDrive, stickyNote. Webhook trigger; 67 nodes.

Output Parser Structured, Chain Llm, Google Drive +9
AI & RAG

Candidate Engagement | Resume Screening | AI Voice Interviews | Applicant Insights

Output Parser Structured, Chain Llm, Google Drive +9
AI & RAG

Transform your WhatsApp group conversations into actionable business intelligence through automated AI analysis and daily reporting. This workflow eliminates manual conversation monitoring by capturin

OpenRouter Chat, Output Parser Autofixing, Agent +6