06 - Building a Financial Statement Analyzer in 15 Minutes Using AI Agents, n8n & GPT-4o

Building a Financial Statement Analyzer in 15 Minutes Using AI Agents, n8n & GPT-4o


From Concepts to Code: Our First Hands-On GenAI Project

As I mentioned at the start of this blog series, this space isn't just for high-level ideas and industry perspectives — it's also a place to roll up our sleeves and build.

While the last few posts explored theoretical foundations, ethical considerations, and strategic frameworks around GenAI, it’s time to mix things up with something a bit more hands-on.

Starting this week, I’ll be sharing a few mini-projects — simple yet meaningful applications of Generative AI. These are designed to help you:

  • Get comfortable with GenAI APIs and tools

  • See real-world implementation patterns

  • Learn by doing — not just reading

  • Build your confidence to take on larger, domain-specific use cases

Here’s the first project to kick things off 

Financial data analysis is often manual, time-consuming, and error-prone. So I challenged myself: Can I build an AI-powered analyzer in under 15 minutes?
Spoiler alert: Yes, with the help of n8n, OpenAI, Pinecone, and Google Workspace.


Enter RAG: Retrieval-Augmented Generation in Action

This project is a textbook example of RAGRetrieval-Augmented Generation.

Rather than relying solely on a language model's memory, we augment the model’s reasoning by retrieving relevant context from a custom-built knowledge base (in this case, financial statements from Northern Trust Bank, Q3 & Q4 2024).

Here’s how it works:

  1. Document Ingestion: Files are uploaded to Google Drive.

  2. Chunking & Embedding: Content is split (with tuned chunk sizes and overlaps), embedded using OpenAI’s text-embedding-3-small.

  3. Vector Search: Embeddings are stored and searched in Pinecone.

  4. LLM: GPT-4o retrieves the most relevant chunks and answers the user query — with direct access to the financial data context.

The RAG architecture lets the system compare figures, understand trends, and even highlight changes in financial KPIs across quarters — capabilities that go far beyond what traditional keyword search or static chat prompts can do.


Why Build This? — Benefits

  • Fast Insights: Instantly extract key metrics and financial ratios from statements.

  • Business-Ready: Works seamlessly with Google Drive and Docs — ideal for teams.

  • Modular: Built using no-code/low-code tools; easy to customize or extend.

  • Gen AI-Powered: Uses GPT-4o and embeddings to reason over financial data contextually.

  • Document-Aware: Accepts real-world financial statement formats from Drive.


Architecture

Here’s how everything ties together:

Knowledge Builder Agent (Agent 1)

  • Google Drive: Upload financial statements in .docx.pdf, or .txt format.
  • Trigger: New document upload in Google Drive.

  • Parse: File is split using a Recursive Character Text Splitter.

  • Embedding with OpenAI: Converts the document content to vector format using text-embedding-3-small.
  • Pinecone Vector DB: Stores and indexes the vectorized content.

     This process builds a knowledge repository of financial documents (in this case, Q3 & Q4 2024).



AI Chat Agent (Agent 2)

  • Trigger: User sends a query (e.g., "Compare revenue between Q3 and Q4").

  • AI Agent: Powered by GPT-4o with access to tools:

    • Pinecone (for vector retrieval)

    • Calculator (for inline math)

    • Context Memory

  • Response: Generates insightful summaries and side-by-side comparisons.

        It seamlessly cross-references multiple financial reports, understands temporal and numerical relationships, and responds with human-like clarity.




AI Agent & Deployment

  • LLM Backbone: OpenAI gpt-4o brings speed and multi-modal reasoning.

  • Embedding Model: text-embedding-3-small keeps the project lightweight yet effective.

  • Search & Retrieval: Pinecone serves as the fast vector store for relevant context.

  • Deployment:

    • Hosted on a local n8n instance (can be cloud-based too).

    • Integrated with Google APIs using service accounts.

    • Runs autonomously with triggers and webhooks.

No server management. No deep coding. Just plug-and-play AI automation.


Tech Stack

  • Platform: n8n – no-code orchestration

  • Chat Model: OpenAI gpt-4o

  • Embedding: OpenAI text-embedding-3-small

  • Vector Store: Pinecone 


Key Learnings

  • Chunk Size & Overlap Matters in RAG: One of the most important (and tricky) aspects of Retrieval-Augmented Generation (RAG) is configuring chunk size and chunk overlap.
    Initially, I used small values (due to the small size of the Q3 & Q4 files), but the results lacked coherence — it seemed like the AI couldn't understand relationships across segments.
    After experimenting, I found that increasing the chunk size to 750 and the overlap to 50 significantly improved result quality.

    The larger chunks helped maintain semantic context across financial figures and paragraphs.

    Let me discuss Chunk size in detail. Smaller chunk size allow for more diverse information. Model can process more chunk which can provide diverse information to process. However small chunk can cause loss of information as discussed in above example. It also increases computational overhead as vector need to process more chunk and build more indexes.
  • Tradeoff to Consider: With modern models like GPT-4o, larger chunks are handled more efficiently, so it's worth trying higher values — but the cost impact is still something to watch.
    Takeaway: Tune chunking based on your document structure and use case. There’s no one-size-fits-all in RAG pipelines.

  • Embeddings unlock reasoning: Going beyond keyword search, embeddings allow GPT to understand and relate data points across documents.

        Retrieval can be term-based and embedding-based. Term-based is generally faster and less expensive as it do not need additional vector database & embedding cost.
  • Separation of agents = scalability: One agent for ingestion, another for querying makes the system easier to manage and extend.

  • Lightweight models worktext-embedding-3-small handled this use case brilliantly without high cost.
Gen AI + Automation = Magic : Especially when you add context-aware embeddings to the mix.









What’s the Potential?

This quick prototype just scratches the surface. With the right tuning, this AI-powered analyzer could evolve into a full-fledged financial intelligence assistant. Some powerful directions to explore:

  • CFO Copilot: Chat with any number of quarterly reports, auto-generate executive summaries, and highlight red flags.

  • Financial Ratio Engine: Auto-calculate and track KPIs like debt-to-equity, net interest margin, or return on equity across periods and institutions.

  • Multi-bank Comparison Tool: Ingest statements from different banks and benchmark their performance side-by-side.

  • PDF to Dashboard Pipeline: Upload a financial statement, get a clean, interactive dashboard with filters and insights — no spreadsheet needed.

  • Continuous Learning System: Fine-tune chunking and embeddings based on feedback or performance scores.

  • Integration with ERP/CRM: Plug into business systems for real-time data and contextual querying across operations.

With modern LLMs and tools like n8n, the gap between a prototype and a product is smaller than ever.


✍️ Author’s Note

This blog reflects the author’s personal point of view — shaped by 22+ years of industry experience, along with a deep passion for continuous learning and teaching.
The content has been phrased and structured using Generative AI tools, with the intent to make it engaging, accessible, and insightful for a broader audience.


Comments

Popular posts from this blog

01 - Why Start a New Tech Blog When the Internet Is Already Full of Them?

13 - Voice of Industry Experts - The Smart Shift: AI in Project Management

02 - How the GenAI Revolution is Different