low-key-007/financial-analyst-api
0
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
๐ FinSight: RAG-Driven Financial Audit Engine
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:
Textractfor 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-v2maps text to a 384-dimensional vector space. - Indexing:
FAISSenables 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).
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.