juanjuandog/FinSight-AI

AI equity research agent with resilient workflows, Redis Lua single-flight, pgvector RAG, versioned reports, evidence tracing, and RAG evaluation.

What it solves

FinSight AI addresses the reliability and infrastructure gaps in typical RAG (Retrieval-Augmented Generation) demos. Instead of simply connecting a model to a database, it provides a production-ready framework for institutional equity research, ensuring that AI-generated financial reports are evidence-grounded, versioned, and generated through a resilient, traceable workflow.

How it works

The system operates as a backend-heavy orchestration layer that transforms raw financial data into research reports through several stages:

  1. Data Ingestion & Metrics: It ingests filings and reports, calculating financial health metrics (profitability, debt ratios, etc.) and identifying risk signals.
  2. Workflow Orchestration: A state machine manages long-running tasks (ingestion, indexing, analysis) using RabbitMQ for async queuing and Redis Lua leases with fencing tokens to prevent duplicate execution.
  3. Hybrid Retrieval: It uses PostgreSQL with pgvector and JSONB to combine keyword and vector search, ensuring that AI answers are bound to specific evidence chunks from documents.
  4. Intelligence Modeling: It builds a company timeline and a lightweight knowledge graph of entities and relations to provide deeper context.
  5. AI Generation & Caching: A FastAPI AI service (with Ollama support) generates reports. These are cached based on a dataSnapshotHash, meaning reports are automatically invalidated and regenerated if the underlying financial data changes.
  6. Evaluation: A built-in evaluation service checks for hallucination risk, evidence coverage, and conclusion consistency.

Who it’s for

  • Developers building professional AI agents that require high reliability and strict evidence traceability.
  • Financial analysts or engineers creating automated equity research tools.
  • Software architects interested in implementing idempotent, recoverable AI workflows.

Highlights

  • Resilient Workflows: Implements a task status machine with retry logic and dead-letter queues for failure recovery.
  • Evidence-Grounded RAG: Uses hybrid recall and evidence traceability to minimize hallucinations in financial reports.
  • Snapshot-Based Caching: Ties AI report versions to specific data snapshots rather than prompt strings.
  • Concurrency Control: Employs idempotency keys and Redis single-flight leases to ensure stable execution across nodes.
  • Built-in Eval: Includes a regression-style evaluation suite to measure RAG hit rate and answer coverage.