RAG Workflow For Stock Earnings Report Analysis n8n Workflow Template

n8n workflow template · 15 nodes · Pinecone

RAG Workflow For Stock Earnings Report Analysis is a free n8n workflow template that starts when you run it manually in the n8n editor and works with Pinecone, Google Gemini, OpenAI, Google Docs, Google Sheets and Google Drive. It has 15 nodes, 10 of them AI nodes (Pinecone Vector Store, Google Gemini Embeddings, Default Data Loader and Recursive Character Text Splitter). To run it, you add your own credentials for Google Docs OAuth2, Google Drive OAuth2, Google Gemini (PaLM) API, Google Sheets OAuth2 and OpenAI API and others.

At a glance

Trigger
Manual Trigger (When clicking ‘Test workflow’)
Nodes
15
Apps
Pinecone, Google Gemini, OpenAI, Google Docs, Google Sheets and Google Drive
AI nodes
10
Credentials
6 types
Category
RAG, documents and vector search

Apps and integrations

  • Pinecone
  • Google Gemini
  • OpenAI
  • Google Docs
  • Google Sheets
  • Google Drive

Node types used

  • Pinecone Vector Store
  • Google Gemini Embeddings
  • Default Data Loader
  • Recursive Character Text Splitter
  • Loop Over Items
  • Manual Trigger
  • AI Agent
  • Vector Store Question Answer Tool
  • Google Gemini Chat Model
  • OpenAI Chat Model
  • Google Docs
  • Google Sheets
  • Google Drive

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

AI Agent Report Generation using RAG

Loading data to Pinecone vector store

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

Set up steps

  1. Google Cloud Project & Vertex AI API
  • Create a Google Cloud project.
  • Enable the Vertex AI API for your project.
  1. Google AI API key
  • Obtain a Google AI API key from Google AI Studio.
  1. 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.
  1. 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
  1. 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)
  1. 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.

Nodes in this workflow

The 15 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. Pinecone Vector Store (Pinecone Vector Store)
  2. Embeddings Google Gemini (Google Gemini Embeddings)
  3. Default Data Loader (Default Data Loader)
  4. Recursive Character Text Splitter (Recursive Character Text Splitter)
  5. Loop Over Items (Loop Over Items)
  6. When clicking ‘Test workflow’ (Manual Trigger)
  7. AI Agent (AI Agent)
  8. Vector Store Tool (Vector Store Question Answer Tool)
  9. Google Gemini Chat Model1 (Google Gemini Chat Model)
  10. OpenAI Chat Model (OpenAI Chat Model)
  11. Pinecone Vector Store (Retrieval) (Pinecone Vector Store)
  12. Save Report to Google Docs (Google Docs)
  13. Embeddings Google Gemini (retrieval) (Google Gemini Embeddings)
  14. List Of Files To Load (Google Sheets) (Google Sheets)
  15. Download File From Google Drive (Google Drive)

Credentials you need

  • Google Docs OAuth2 – used by Save Report to Google Docs
  • Google Drive OAuth2 – used by Download File From Google Drive
  • Google Gemini (PaLM) API – used by Embeddings Google Gemini, Embeddings Google Gemini (retrieval) and Google Gemini Chat Model1
  • Google Sheets OAuth2 – used by List Of Files To Load (Google Sheets)
  • OpenAI API – used by OpenAI Chat Model
  • Pinecone API – used by Pinecone Vector Store and Pinecone Vector Store (Retrieval)

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us