Skip to main content

AI-powered RAG workflow for stock earnings report analysis

Workflow preview

Workflow preview
100%
AI-powered RAG workflow for stock earnings report analysis preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This n8n workflow creates a financial analysis tool that generates reports on a company's quarterly earnings using the capabilities of OpenAI GPT 4o mini, Google's Gemini AI and Pinecone's vector s...

Best for

  • Crypto Trading automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

@n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsgooglegemini, @n8n/n8n-nodes-langchain.documentdefaultdataloader, @n8n/n8n-nodes-langchain.textsplitterrecursivecharactertextsplitter, n8n-nodes-base.splitinbatches, n8n-nodes-base.manualtrigger, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.toolvectorstore

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Mihai Farcas.

Original n8n.io source

1.1 Workflow description

Title
AI-powered RAG workflow for stock earnings report analysis
Workflow name
AI-powered RAG workflow for stock earnings report analysis

This n8n workflow creates a financial analysis tool that generates reports on a company's quarterly earnings using the capabilities of OpenAI GPT-4o-mini, Google's Gemini AI and Pinecone's vector search. By analyzing PDFs of any company's earnings reports from their Investor Relations page, this workflow can answer complex financial questions and automatically compile findings into a structured Google Doc.

How it works:

  1. Data loading and indexing
  • Fetches links to PDF earnings document from a Google Sheet containing a list of file links.
  • Downloads the PDFs from Google Drive.
  • Parses the PDFs, splits the text into chunks, and generates embeddings using the Embeddings Google AI node (text-embedding-004 model).
  • Stores the embeddings and corresponding text chunks in a Pinecone vector database for semantic search.
  1. Report generation with AI agent
  • Utilizes an AI Agent node with a specifically crafted system prompt. The agent orchestrates the entire process.
  • The agent uses a Vector Store Tool to access and retrieve information from the Pinecone database.
  1. Report delivery
  • Saves the generated report as a Google Doc in a specified Google Drive location.

Set up steps

  1. Google Cloud Project & Vertex AI API:
    • Create a Google Cloud project.
    • Enable the Vertex AI API for your project.
  2. Google AI API key:
    • Obtain a Google AI API key from Google AI Studio.
  3. Pinecone account and API key:
    • Create a free account on the Pinecone website.
    • Obtain your API key from your Pinecone dashboard.
    • Create an index named company-earnings in your Pinecone project.
  4. Google Drive - download and save financial documents:
    • Go to a company you want to analize and download their quarterly earnings PDFs
    • Save the PDFs in Google Drive
    • Create a Google Sheet that stores a list of file URLs pointing to the PDFs you downloaded and saved to Google Drive
  5. Configure credentials in your n8n environment for:
    • Google Sheets OAuth2
    • Google Drive OAuth2
    • Google Docs OAuth2
    • Google Gemini(PaLM) Api (using your Google AI API key)
    • Pinecone API (using your Pinecone API key)
  6. Import and configure the workflow:
    • Import this workflow into your n8n instance.
    • Update the List Of Files To Load (Google Sheets) node to point to your Google Sheet.
    • Update the Download File From Google Drive to point to the column where the file URLs are
    • Update the Save Report to Google Docs node to point to your Google Doc where you want the report saved.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 2 - Embeddings Google Gemini

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 3 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 4 - Recursive Character Text Splitter

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 5 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 6 - When clicking ‘Test workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 7 - AI Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.7

Block 8 - Vector Store Tool

Type / Role
@n8n/n8n-nodes-langchain.toolVectorStore - toolVectorStore
Config choices
Version 1

Block 9 - Google Gemini Chat Model1

Type / Role
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - lmChatGoogleGemini
Config choices
Version 1

Block 10 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.1

Block 11 - Pinecone Vector Store (Retrieval)

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 12 - Save Report to Google Docs

Type / Role
n8n-nodes-base.googleDocs - googleDocs
Config choices
Version 2

Block 13 - Embeddings Google Gemini (retrieval)

Type / Role
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini - embeddingsGoogleGemini
Config choices
Version 1

Block 14 - List Of Files To Load (Google Sheets)

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 15 - Download File From Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 16 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 17 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 18 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow AI-powered RAG workflow for stock earnings report analysis
Complexity advanced
Nodes 18
Categories Crypto Trading, AI RAG
Author Mihai Farcas
Published 17 Jan 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2741/2741.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does AI-powered RAG workflow for stock earnings report analysis do?

This n8n workflow creates a financial analysis tool that generates reports on a company's quarterly earnings using the capabilities of OpenAI GPT 4o mini, Google's Gemini AI and Pinecone's vector s...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Crypto Trading, AI RAG use case.