Skip to content

Commit f87feb8

Browse files
committed
feat: add flowchart images
1 parent d150efe commit f87feb8

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
*.pdf
21
__MACOSX
32
.DS_Store
43
.vscode/
@@ -56,7 +55,7 @@ logs/
5655
*.csv
5756
*.xlsx
5857
*.xls
59-
dataset/raw/
58+
dataset/**/*.pdf
6059
data/
6160
*.pkl
6261
*.pickle

latex/images/flusso.key

371 KB
Binary file not shown.

latex/images/flusso.pdf

29.5 KB
Binary file not shown.

latex/sections/03_architecture.tex

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ \subsection{Core Components}
99

1010
The system is composed of several interrelated components that work together to deliver financial advisory services. The agent layer contains specialized AI agents built on top of the datapizza-ai framework.\footnote{\url{https://github.com/datapizza-labs/datapizza-ai}.} BaseAgent serves as an abstract foundation that encapsulates common agent functionality including initialization, configuration loading, system prompt management, and tool registration. All specialized agents inherit from BaseAgent to ensure consistency and reduce code duplication. ChatbotAgent focuses on natural conversation and financial profile extraction, maintaining conversation history and interpreting user intent while guiding users toward providing relevant financial information. FinancialAdvisorAgent specializes in portfolio generation and analysis, utilizing RAG to access historical financial data and providing evidence-based recommendations.
1111

12-
The data model layer ensures type safety and clear data contracts throughout the system. FinancialProfile captures demographic and financial characteristics including age, employment status, income, expenses, debt, savings, investment experience, risk tolerance, and financial goals. Portfolio represents investment recommendations including asset allocations, expected returns, volatility metrics, and diversification ratios. PACMetrics encodes portfolio analysis metrics including PAC (patrimonio atteso) values, performance indicators, and risk assessment. These models are implemented using Pydantic, which enforces type safety at runtime and provides validation.
12+
The data model layer ensures type safety and clear data contracts throughout the system. FinancialProfile captures demographic and financial characteristics including age, employment status, income, expenses, debt, savings, investment experience, risk tolerance, and financial goals. Portfolio represents investment recommendations including asset allocations, expected returns, volatility metrics, and diversification ratios. PACMetrics encodes portfolio analysis metrics including PAC (piano di accumulo) values, performance indicators, and risk assessment. These models are implemented using Pydantic, which enforces type safety at runtime and provides validation.
1313

1414
The retrieval layer implements retrieval-augmented generation specifically for financial data. RAGAssetRetriever maintains a vector database of historical ETF and stock data, supports semantic search for relevant financial assets, integrates historical price data spanning ten years, and provides structured asset information for recommendations. This component is essential for grounding LLM recommendations in factual, historical information rather than allowing the model to generate potentially inaccurate figures.
1515

@@ -24,3 +24,10 @@ \subsection{Multi-Provider LLM Support}
2424
\subsection{Data-Flow}
2525

2626
The typical interaction flow through the system follows a well-defined sequence. A user initiates conversation with ChatbotAgent, which engages the user in dialogue to gather financial information. The user provides profile details and financial goals through natural conversation. FinancialAdvisorAgent then extracts a structured FinancialProfile from the conversation history using the LLM with structured output capabilities. The agent queries RAGAssetRetriever for suitable assets based on the user's profile constraints. The portfolio generation logic combines user preferences with historical data to create a diversified portfolio. The system presents recommendations to the user with comprehensive analysis including historical performance, risk metrics, and diversification ratios. The user can refine preferences and iterate through the analysis cycle, with the agent updating recommendations based on new information.
27+
28+
\begin{figure}[h]
29+
\centering
30+
\includegraphics[width=\linewidth]{images/flusso.pdf}
31+
\caption{High-level execution flow of the Personal Financial AI Agent.}
32+
\label{fig:execution-flow}
33+
\end{figure}

latex/sections/05_rag.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ \section{Retrieval-Augmented Generation for Financial Data}
33

44
\subsection{Motivation for RAG in Financial Advisory}
55

6-
Retrieval-augmented generation enhances LLM capabilities by grounding responses in retrieved factual information. \\
6+
Retrieval-augmented generation enhances LLM capabilities by grounding responses in retrieved factual information.
77

8-
This approach overcomes the intrinsic limitation of static knowledge in large language models, whose internal representations are fixed at training time and cannot reflect newly available or frequently changing information. This is particularly useful since pre-trained models were used for this project. By dynamically retrieving relevant documents at inference time, RAG enables the model to operate on up-to-date, domain-specific, and potentially proprietary knowledge without requiring modifications to the underlying parameters.
8+
This approach overcomes the intrinsic limitation of static knowledge in LLMs, whose internal representations are fixed at training time and cannot reflect newly available or frequently changing information. This is particularly useful since pre-trained models were used for this project. By dynamically retrieving relevant documents at inference time, RAG enables the model to operate on up-to-date, domain-specific, and potentially proprietary knowledge without requiring modifications to the underlying parameters.
99

1010
Moreover, grounding generation in retrieved factual sources significantly mitigates the risk of hallucinations, as the model is encouraged to base its responses on explicit evidence rather than relying solely on learned statistical patterns. This characteristic is particularly important in scenarios where factual accuracy, reliability, and consistency are critical, such as in the financial sector. Using real historical data rather than hallucinated figures ensures that recommendations are based on verifiable information. Relevance is equally important, as finding assets that match user criteria from available options requires domain knowledge that the system must possess. Compliance considerations mean providing factual, verifiable information that can withstand scrutiny from regulators. Interpretability allows showing users which data informed recommendations, building trust in the advice-giving process. The system retrieves relevant ETFs and stocks based on user preferences and financial profiles, providing 10-year historical return data for each recommendation.
1111

0 commit comments

Comments
 (0)