# FinSight AI

> Evidence-grounded A-share equity research with recoverable workflows and snapshot-bound reports

- Category: Agents & Automation / Finance & Market Agents
- Language: Java
- Licence: MIT
- Repository: https://github.com/juanjuandog/FinSight-AI
- Canonical page: https://ai-tldr.dev/tools/finsight-ai/

## In short

FinSight AI is an open-source research workspace for China A-share companies. It sits in the Finance & Market Agents category of the Agents & Automation tools and is open-source, written in Java and licensed MIT. To get started: lightweight preview.

## Overview

FinSight AI is an open-source research workspace for China A-share companies. You search a company, inspect its quote, historical close-price curve and key financial metrics, and ask the AI to produce a structured conclusion with a confidence level, supporting factors and risk factors. Separate workspaces cover company research, AI analysis, evidence search over filings and announcements, a timeline of recent events, and a watchlist. The project states plainly that it is a research aid, not an automated trading system, and that its output is not investment advice.

What sets it apart is the engineering around the model call. A Spring Boot (Java 17) service owns the workflow: a research request becomes an idempotent task, RabbitMQ dispatches the stages (data ingestion, metric calculation, indexing, intelligence building, report generation), and failed stages get retries, timeout takeover and dead-letter handling. Redis Lua leases with fencing tokens stop identical requests from running the same expensive work twice. Every report records a data snapshot hash, a context hash and a report version, so a cached report cannot silently outlive the data it was built from.

Retrieval combines PostgreSQL full-text search with pgvector, merges the results with reciprocal-rank fusion and reranks them, keeping an evidence trace for each conclusion and a regression evaluation for the retrieval itself. Embedding, reranking and generation live in a separate FastAPI sidecar with adapters for Ollama (the default), OpenAI-compatible APIs and Anthropic; when a model is unavailable or unconfigured, deterministic fallbacks keep the flow running. Reports are immutable versions that can be compared side by side and exported as Markdown or PDF. The project is MIT-licensed.

## What it does

- Five focused workspaces: Company Research, AI Analysis, Evidence, Recent Events and Watchlist
- Recoverable research workflows over RabbitMQ with explicit task states, retries, timeout takeover and dead-letter handling
- Idempotency keys plus a Redis Lua single-flight lease and fencing token to stop duplicate expensive runs
- Hybrid RAG: full-text and pgvector recall, reciprocal-rank fusion, reranking, an evidence trace and regression evaluation
- Snapshot-bound, immutable report versions with a side-by-side diff against the previous version and Markdown or PDF export
- FastAPI model sidecar with Ollama, OpenAI-compatible and Anthropic adapters and deterministic fallbacks when no model is configured

## Getting started

The README offers two paths: a lightweight preview that needs only Java 17 and Maven and runs on in-memory adapters, and a full Docker Compose stack with PostgreSQL/pgvector, Redis, RabbitMQ, the Spring Boot backend and the FastAPI AI sidecar. The default demo needs no API key.

1. Lightweight preview

   Runs the product and core flow with local in-memory adapters and no infrastructure services, then serves the UI at http://localhost:8080.

```bash
git clone https://github.com/juanjuandog/FinSight-AI.git
cd FinSight-AI/backend
mvn spring-boot:run
```

2. Full research stack

   Starts every service with Docker Compose and seeds demo data. The README asks for roughly 8 GB of free memory for the complete stack; if the dashboard opens with no data, re-run the demo script and refresh.

```bash
git clone https://github.com/juanjuandog/FinSight-AI.git
cd FinSight-AI
docker compose up -d --build
./scripts/quick-demo.sh
```

3. Choose a generation model

   The default provider is Ollama (`LLM_PROVIDER=ollama`). Copy `.env.example` to an ignored `.env` and set `LLM_PROVIDER` to `ollama`, `openai-compatible` or `anthropic` with that provider's base URL, model and key. Without a working model FinSight falls back to rule-based analysis and marks it `aiGenerated=false`.

```bash
ollama serve
ollama pull qwen2.5:7b
```

4. Run the tests

   The backend suite includes Testcontainers smoke tests for PostgreSQL/pgvector and RabbitMQ, which are skipped when Docker is not available.

```bash
cd backend
mvn test
```

## When to use it

- Research an A-share company with an AI conclusion whose supporting and risk points trace back to filings, announcements and metrics
- Track how a company's AI research rating changes over time by diffing immutable report versions and exporting them as Markdown or PDF
- Run AI equity research fully locally on Ollama, or switch to an OpenAI-compatible or Anthropic model through one setting
- Study a reference backend for reliable AI agents: recoverable workflows, idempotent tasks, Redis leases and snapshot-bound caching
