How dartrint/ai-financial-assistant works
AI Financial Assistant serves Vietnamese financial questions through separate market-data, knowledge-RAG, and combined-analysis flows. The principal local workflow starts at the FastAPI or CLI entry point, reaches FinancialAgent for intent routing and entity extraction, then selects a tool; responses include analysis and citations. The web deployment instead uses a Cloudflare frontend and Supabase Edge Function, with optional signed-in history and model-provider fallbacks. The graph preserves ETL and evaluation capabilities documented in the README. Some web and tool internals were not excerpted, so those links rely on README statements rather than inspected implementation.
Main entry points: agent.py FinancialAgent · run_etl.py ETL Runner · hybrid_retriever.py Hybrid Retrieval · router.py LLM Router
Components 34
Local Application
- FastAPI API
app.py - CLI
main.py - FinancialAgent
agent.py - Financial Config
config.py - Tool Registry
tools/base.py - LLM Router
llm/router.py - Provider Interface
llm/base.py - Groq Provider
llm/groq_provider.py - Gemini Provider
llm/gemini_provider.py - Ollama Provider
llm/ollama_provider.py
Market Analysis
- Market Tool
tools/market_data.py - Stock Analysis
tools/stock_analysis.py - Economic Analysis
tools/economic_analysis.py - Portfolio Metrics
tools/portfolio_metrics.py - Source Aggregator
market_data/aggregator.py - vnstock Adapter
market_data/vnstock_source.py - EcoData Adapter
market_data/ecodata_source.py - Yahoo Adapter
market_data/yahoo_source.py - DuckDB Store
market_data/duckdb_store.py
Knowledge RAG
- Concept Explainer
tools/explain_concept.py - Knowledge Base
knowledge/loader.py - Qdrant Store
knowledge/qdrant_store.py - Collection Setup
knowledge/collections.py - Hybrid Retrieval
retrieval/hybrid_retriever.py - BM25 Retrieval
retrieval/bm25_retriever.py - Dense Retrieval
retrieval/embedding_retriever.py - Reranker
retrieval/reranker.py
Knowledge ETL
- ETL Runner
etl/run_etl.py - Source Discovery
etl/sources.py - Content Extraction
etl/extract.py - Content Cleanup
etl/transform.py - Document Chunker
etl/chunker.py - ETL State
etl/state.py
Other components
- User
Connections 34
- User → FastAPI API: asks via API
README.md - User → CLI: asks via CLI
README.md - FastAPI API → FinancialAgent: invokes
app.py - CLI → FinancialAgent: uses
main.py - FinancialAgent → Tool Registry: selects tool
agent.py - FinancialAgent → Market Tool: dispatches
agent.py - FinancialAgent → Stock Analysis: dispatches
agent.py - FinancialAgent → Economic Analysis: dispatches
agent.py - FinancialAgent → Portfolio Metrics: dispatches
agent.py - FinancialAgent → Concept Explainer: dispatches
agent.py - FinancialAgent → Source Aggregator: uses
agent.py - FinancialAgent → Hybrid Retrieval: uses
agent.py - FinancialAgent → LLM Router: uses
agent.py - Source Aggregator → vnstock Adapter: fetches from
market_data/aggregator.py - Source Aggregator → EcoData Adapter: fetches from
market_data/aggregator.py - Source Aggregator → Yahoo Adapter: fetches from
market_data/aggregator.py - Knowledge Base → Qdrant Store: searches
knowledge/loader.py - Knowledge Base → Collection Setup: ensures collections
knowledge/loader.py - Hybrid Retrieval → Knowledge Base: loads documents
retrieval/hybrid_retriever.py - Hybrid Retrieval → BM25 Retrieval: retrieves
retrieval/hybrid_retriever.py - Hybrid Retrieval → Dense Retrieval: retrieves
retrieval/hybrid_retriever.py - Hybrid Retrieval → Reranker: reranks
retrieval/hybrid_retriever.py - LLM Router → Groq Provider: tries provider
llm/router.py - LLM Router → Gemini Provider: tries provider
llm/router.py - LLM Router → Ollama Provider: tries provider
- Groq Provider → Provider Interface: implements
llm/groq_provider.py - Gemini Provider → Provider Interface: implements
llm/gemini_provider.py - Ollama Provider → Provider Interface: implements
llm/ollama_provider.py - ETL Runner → Source Discovery: discovers sources
etl/run_etl.py - ETL Runner → Content Extraction: extracts content
etl/run_etl.py - ETL Runner → Content Cleanup: cleans content
etl/run_etl.py - ETL Runner → Document Chunker: chunks documents
etl/run_etl.py - ETL Runner → ETL State: tracks state
etl/run_etl.py - ETL Runner → Knowledge Base: loads Qdrant
README.md