CoolFace
Apppublic

low-key-007/financial-analyst-api

sourceHugging Facemitupdated 8mo agoView on Hugging Face
0likes
App README

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

๐Ÿ“Š FinSight: RAG-Driven Financial Audit Engine

Python LangChain Llama 3 FAISS

FinSight is an automated document intelligence system designed to streamline financial due diligence. It ingests unstructured financial reports (PDFs, DOCX), creates a semantic vector index, and allows analysts to query complex datasets using natural language.

if you want to access the working website for financial analyst floow this url: "https://bright-babka-476cff.netlify.app/"

๐Ÿ”ฌ Core Capabilities

1. Universal Document Ingestion

Financial data often lives in messy formats. FinSight utilizes a Multi-Stage Extraction Pipeline:

  • โ€”Primary: Textract for general-purpose parsing.
  • โ€”Fallback: PyMuPDF (Fitz) for OCR-heavy PDFs. This ensures 99% data recovery from uploaded audit reports.

2. Retrieval-Augmented Generation (RAG)

Unlike standard LLMs which hallucinate facts, FinSight uses RAG Architecture to ground answers in provided evidence.

  • โ€”Embedding: all-MiniLM-L6-v2 maps text to a 384-dimensional vector space.
  • โ€”Indexing: FAISS enables sub-millisecond similarity search.
  • โ€”Synthesis: Llama 3 (via Groq) generates the final analytical summary.

๐Ÿ— System Architecture

The architecture separates the Ingestion Phase (CPU intensive) from the Inference Phase (API intensive).

mermaid
graph TD
    User([๐Ÿ‘ค Financial Analyst])
    
    subgraph "Ingestion Pipeline"
        Docs[๐Ÿ“„ PDF/DOCX Files] -->|Upload| API[๐Ÿš€ FastAPI]
        API -->|Extract| Parser[โš™๏ธ Ingestion Engine]
        Parser -->|Chunk| Splitter[โœ‚๏ธ Text Splitter]
        Splitter -->|Embed| Vectors[(๐Ÿง  FAISS Vector Store)]
    end
    
    subgraph "Inference Pipeline"
        User -->|Query| API
        API -->|Search| Vectors
        Vectors -->|Context| LLM{๐Ÿฆ™ Llama 3 (Groq)}
        LLM -->|Audit Insight| User
    end







๐Ÿ›  Tech StackComponentTechnologyRationaleLLM InferenceGroq CloudDelivers Llama 3 output at ~800 tokens/sec for real-time analysis.OrchestratorLangChainManages the chain-of-thought retrieval logic.Vector DBFAISSIn-memory efficient similarity search (ideal for session-based analysis).BackendFastAPIAsynchronous handling of multiple concurrent file uploads.







๐Ÿš€ Usage Guide
1. Installation
Bash

git clone [https://github.com/yourusername/finsight-engine.git](https://github.com/yourusername/finsight-engine.git)
cd finsight-engine
pip install -r requirements.txt
2. Configuration
Set your API key in the environment:

Bash

export GROQ_API_KEY="your_groq_key_here"
3. Run the Engine
Bash

uvicorn src.main:app --reload
The API will be live at http://localhost:8000/docs.

4. Workflow
POST /ingest: Upload your "Annual Report 2024.pdf".

POST /ask: Query "What were the primary risk factors mentioned in Q3?"

Result: Receive a cited, context-aware answer.

๐Ÿ‘จโ€๐Ÿ’ป Developer's Note
This project addresses the "Information Overload" problem in finance. By coupling Llama 3's reasoning with FAISS's retrieval speed, we reduce the time required to review a 100-page 10-K report from hours to minutes.