Skip to content

Commit 7b4c204

Browse files
committed
refactor: enhance terminology consistency and improve clarity in architecture, implementation, interface, and conclusion sections
1 parent 9409844 commit 7b4c204

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

latex/main.pdf

10 Bytes
Binary file not shown.

latex/sections/03_architecture.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ \subsection{High-Level Overview}
77

88
\subsection{Core Components}
99

10-
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}.} Base Agent 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 Base Agent to ensure consistency and reduce code duplication. Chatbot Agent focuses on natural conversation and financial profile extraction, maintaining conversation history and interpreting user intent while guiding users toward providing relevant financial information. Financial Advisor Agent specializes in portfolio generation and analysis, utilizing RAG to access historical financial data and providing evidence-based recommendations.
10+
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}.} Base Agent 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 Base Agent to ensure consistency and reduce code duplication. The Chatbot Agent focuses on natural conversation and financial profile extraction, maintaining conversation history and interpreting user intent while guiding users toward providing relevant financial information. Financial Advisor Agent specializes in portfolio generation and analysis, utilizing RAG to access historical financial data and providing evidence-based recommendations.
1111

1212
The data model layer ensures type safety and clear data contracts throughout the system. Financial Profile 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. PAC Metrics 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

@@ -23,7 +23,7 @@ \subsection{Multi-Provider LLM Support}
2323

2424
\subsection{Data-Flow}
2525

26-
The typical interaction flow through the system follows a well-defined sequence. A user initiates conversation with Chatbot Agent, which engages the user in dialogue to gather financial information. The user provides profile details and financial goals through natural conversation. Financial Advisor Agent then extracts a structured Financial Profile from the conversation history using the LLM with structured output capabilities. The agent queries RAG Asset Retriever 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.
26+
The typical interaction flow through the system follows a well-defined sequence. A user initiates conversation with Chatbot Agent, which engages the user in dialogue to gather financial information. The user provides profile details and financial goals through natural conversation. The Financial Advisor Agent then extracts a structured Financial Profile from the conversation history using the LLM with structured output capabilities. The agent queries RAG Asset Retriever 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.
2727

2828
\begin{figure}[h]
2929
\centering

latex/sections/04_implementation.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ \section{Technical Implementation}
33

44
\subsection{Technology Stack}
55

6-
The implementation leverages a carefully selected technology stack optimized for AI, data processing, and web deployment. The core framework is datapizza-ai, a modern italian AI framework specifically designed for building conversational agents with complex orchestration requirements. The datapizza-ai framework provides comprehensive abstractions for agent lifecycle management, message routing, and tool invocation. It abstracts away the complexities of different LLM provider APIs and authentication mechanisms, allowing the system to seamlessly switch between Ollama for local inference, Google Gemini for cloud-based capabilities, or OpenAI's models, without requiring changes to the agent implementation. The framework manages conversation context and memory through a unified interface, handling both immediate conversation history for contextual understanding and persistent memory for long-term user profile management. Additionally, datapizza-ai provides sophisticated tool management capabilities that enable agents to register and invoke external functions as part of their decision-making process, facilitating integration with specialized services like the RAG retriever.
6+
The implementation leverages a carefully selected technology stack optimized for AI, data processing, and web deployment. The core framework is datapizza-ai, a modern Italian AI framework specifically designed for building conversational agents with complex orchestration requirements. The datapizza-ai framework provides comprehensive abstractions for agent lifecycle management, message routing, and tool invocation. It abstracts away the complexities of different LLM provider APIs and authentication mechanisms, allowing the system to seamlessly switch between Ollama for local inference, Google Gemini for cloud-based capabilities, or OpenAI's models, without requiring changes to the agent implementation. The framework manages conversation context and memory through a unified interface, handling both immediate conversation history for contextual understanding and persistent memory for long-term user profile management. Additionally, datapizza-ai provides sophisticated tool management capabilities that enable agents to register and invoke external functions as part of their decision-making process, facilitating integration with specialized services like the RAG retriever.
77

88
The web framework is Streamlit, a Python-based framework enabling rapid development of data applications without requiring JavaScript expertise. Streamlit handles reactive UI updates and state management automatically, greatly reducing development overhead. Pydantic provides runtime type validation and serialization for data models, used extensively for Financial Profile, Portfolio, and related models, ensuring data consistency throughout the system. Qdrant serves as a vector database engine for semantic search over financial documents and embeddings. Plotly enables interactive, publication-quality financial visualizations including candlestick charts, return distributions, and allocation pie charts.
99

latex/sections/06_interface.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ \subsection{Streamlit-Based Web Application}
77

88
\subsection{Application Structure and Management}
99

10-
The Streamlit application is organized into several logical sections. Session management uses Streamlit's built-in session state to maintain current conversation history, extracted financial profiles, generated portfolios, user settings including language and provider preference, and analysis results with associated charts. The application is structured as a multi-page application with several distinct pages. The Chat Page provides the main conversational interface where users interact with Chatbot Agent. The Portfolio Analysis Page displays generated portfolios with detailed metrics and visualizations including allocation charts and historical performance. The Settings Page allows users to configure LLM provider, language, and financial parameters including Monte Carlo simulation settings. The Profile Management Page enables users to load, edit, and save financial profiles as JSON files.
10+
The Streamlit application is organized into several logical sections. Session management uses Streamlit's built-in session state to maintain current conversation history, extracted financial profiles, generated portfolios, user settings including language and provider preference, and analysis results with associated charts. The application is structured as a multi-page application with several distinct pages. The Chat Page provides the main conversational interface where users interact with the Chatbot Agent. The Portfolio Analysis Page displays generated portfolios with detailed metrics and visualizations including allocation charts and historical performance. The Settings Page allows users to configure LLM provider, language, and financial parameters including Monte Carlo simulation settings. The Profile Management Page enables users to load, edit, and save financial profiles as JSON files.
1111

1212
\subsection{Conversation Flow and Profile Interaction}
1313

14-
When a new user arrives at the application, the system displays a welcome message in the user's preferred language. Chatbot Agent initiates a greeting and explains available capabilities, helping the user understand what the system can do. The system requests selection of the LLM provider if not previously configured, allowing users to choose based on their privacy preferences and available resources.
14+
When a new user arrives at the application, the system displays a welcome message in the user's preferred language. The Chatbot Agent initiates a greeting and explains available capabilities, helping the user understand what the system can do. The system requests selection of the LLM provider if not previously configured, allowing users to choose based on their privacy preferences and available resources.
1515

1616
The agent guides users through information collection using a conversational approach. Rather than presenting a form, it asks questions about demographics such as age and employment status. Income and expenses are explored to understand the user's financial capacity. Existing assets and investments are examined to assess current portfolio composition. Risk tolerance is evaluated through behavioral questions rather than abstract risk rating scales. Finally, financial goals and time horizons are discussed to set appropriate expectations. The conversational approach is natural and adaptive, with questions varying based on previous answers, making the interaction feel like speaking with a knowledgeable advisor.
1717

18-
Once sufficient information is gathered, the portfolio generation process begins. The user requests a portfolio recommendation either explicitly or implicitly through the conversation. Financial Advisor Agent receives the full conversation context. The agent extracts a Financial Profile using the LLM with structured output to ensure data quality. Then, it builds a RAG query based on profile constraints. Relevant assets are retrieved from the vector database. The agent generates a portfolio with specific allocation percentages. The system validates the portfolio structure to ensure allocations sum to 100 percent and comply with constraints. The portfolio is presented to the user with comprehensive analysis including expected return, volatility, and diversification metrics.
18+
Once sufficient information is gathered, the portfolio generation process begins. The user requests a portfolio recommendation either explicitly or implicitly through the conversation. The Financial Advisor Agent receives the full conversation context. The agent extracts a Financial Profile using the LLM with structured output to ensure data quality. Then, it builds a RAG query based on profile constraints. Relevant assets are retrieved from the vector database. The agent generates a portfolio with specific allocation percentages. The system validates the portfolio structure to ensure allocations sum to 100 percent and comply with constraints. The portfolio is presented to the user with comprehensive analysis including expected return, volatility, and diversification metrics.
1919

2020
\subsection{Visualization and Display Components}
2121

latex/sections/08_conclusion.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ \section{Conclusion}
22

33
The Personal Financial AI Agent demonstrates that artificial intelligence can effectively augment human financial decision-making. By combining conversational AI, retrieval-augmented generation, and modern web technologies, the system creates an offering that is simultaneously intelligent, accessible, and trustworthy. The modular architecture and emphasis on provider flexibility ensure longevity as the AI landscape continues to evolve. The comprehensive testing and documentation enable both researchers and practitioners to build upon this foundation.
44

5-
As AI increasingly shapes financial services, maintaining focus on user trust, transparency, and privacy will be crucial. This project provides a template for building AI systems in regulated domains where accuracy and trustworthiness are paramount. Financial advisory is a domain where AI's promise to democratize expertise must be balanced with responsibility to protect users from misinformation and poor recommendations. By emphasizing grounding in real data through RAG, supporting multiple inference options for privacy, and maintaining transparent about limitations, this system demonstrates an approach to trustworthy AI in high-stakes domains.
5+
As AI increasingly shapes financial services, maintaining focus on user trust, transparency, and privacy will be crucial. This project provides a template for building AI systems in regulated domains where accuracy and trustworthiness are paramount. Financial advisory is a domain where AI's promise to democratize expertise must be balanced with responsibility to protect users from misinformation and poor recommendations. By emphasizing grounding in real data through RAG, supporting multiple inference options for privacy, and maintaining transparency about limitations, this system demonstrates an approach to trustworthy AI in high-stakes domains.
66

77
Despite its strengths, the system has several inherent limitations that should be acknowledged. Model dependency means system quality is fundamentally bounded by underlying LLM capabilities, with smaller models showing limitations in financial reasoning compared to larger models. Data currency presents a challenge since historical financial data has a fixed lookback window, and real-time market data integration would improve recommendations. Limited risk modeling is employed, with simplified volatility metrics; advanced portfolio construction techniques such as mean-variance optimization and factor models could enhance recommendations. The system provides recommendations only and cannot execute trades, so integration with trading platforms would require additional compliance and security measures. Scalability is limited since the current architecture uses in-memory processing, and distributed systems would be needed for enterprise-scale deployment.
88

0 commit comments

Comments
 (0)