Manoj21k commited on
Commit
c9b4028
β€’
1 Parent(s): bc6b22b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +87 -79
README.md CHANGED
@@ -1,80 +1,88 @@
1
- # FinBuddy Project
2
-
3
- ## Overview
4
-
5
- FinBuddy is an AI Assistant designed to help users with questions related to financial metrics of Microsoft (MSFT), Tesla (TSLA), and Apple (AAPL). The project uses a combination of rule-based logic and machine learning models to provide answers in different formats such as text responses, tables, and charts. The application is built using Streamlit for the user interface and integrates with LangChain and Groq for the underlying AI functionalities.
6
-
7
- ## Project Structure
8
-
9
- The project consists of three main components:
10
-
11
- 1. **main.py**: This script handles the core functionalities of the AI assistant, including initializing the language models, creating agents, and defining the conversation handling logic.
12
- 2. **rule_based.py**: This script contains the rule-based logic for providing predefined answers to specific queries.
13
- 3. **app.py**: This script sets up the Streamlit interface and integrates the rule-based and AI-driven responses.
14
-
15
- ## File Descriptions
16
-
17
- ### `main.py`
18
- - **Imports and Initialization**: Sets up necessary imports, initializes the Groq client and model, and defines chat history.
19
- - **Agent Creation**: Creates a CSV agent using LangChain's `create_csv_agent` function to handle queries related to financial metrics.
20
- - **Functions**:
21
- - `convo_agent`: Handles simple conversational queries.
22
- - `csv_agent`: Processes financial queries and formats responses as tables, bar charts, or line charts.
23
- - `run_conversation`: Manages the flow of the conversation by determining which function to use based on the user query.
24
- - `get_response`: Processes the user query, interacts with the agents, and returns the appropriate response.
25
- - `write_answer`: Formats and displays the response in Streamlit, including rendering tables and charts.
26
-
27
- ### `rule_based.py`
28
- - **simple_chatbot**: A simple rule-based chatbot that returns predefined answers for specific queries related to the total revenue of MSFT, AAPL, and TSLA for 2022 and 2023.
29
-
30
- ### `app.py`
31
- - **Streamlit Setup**: Initializes the Streamlit app, sets the title, and displays chat history.
32
- - **Message Handling**: Captures user input, retrieves responses from the AI assistant or rule-based bot, and displays the responses.
33
- - **Integration**: Integrates `get_response` from `main.py` and `simple_chatbot` from `rule_based.py` to handle user queries.
34
-
35
- ## Project Flow
36
-
37
- 1. **User Interaction**:
38
- - The user interacts with the Streamlit app by typing a query into the chat input.
39
-
40
- 2. **Message Capture**:
41
- - The app captures the user's input and appends it to the chat history.
42
-
43
- 3. **Response Generation**:
44
- - The `get_response` function is called with the user query.
45
- - `get_response` decides whether to use the `convo_agent` or `csv_agent` based on the nature of the query.
46
- - The appropriate agent processes the query and returns the response.
47
-
48
- 4. **Rule-Based Check**:
49
- - Optionally, the response can be generated by the `simple_chatbot` for predefined queries if the rule-based option is enabled.
50
-
51
- 5. **Response Display**:
52
- - The response is formatted and displayed in the Streamlit app.
53
- - If the response includes a table or chart, it is rendered accordingly.
54
-
55
- 6. **Chat History Update**:
56
- - The chat history is updated with the new user query and the AI response.
57
-
58
- ## How to Run
59
- Configuring Groq API
60
- Create an API Key:
61
-
62
- Visit the [Groq Console](https://console.groq.com/docs/api-reference#chat) and create an API key.
63
-
64
- 1. Ensure you have the necessary dependencies installed:
65
- ```bash
66
- pip install -r requirements.txt
67
- ```
68
-
69
- 2. Run the Streamlit app:
70
- ```bash
71
- streamlit run app.py
72
- ```
73
-
74
- 3. Interact with the FinBuddy assistant through the Streamlit interface by typing queries related to the financial metrics of MSFT, TSLA, and AAPL.
75
-
76
- Current this doesn't support Visualization or table, will be added in next iteration.
77
-
78
- ## Conclusion
79
-
 
 
 
 
 
 
 
 
80
  FinBuddy is a robust AI assistant designed to help users with financial queries. By combining rule-based logic and advanced AI models, it provides accurate and formatted responses to a variety of questions. The use of Streamlit ensures a user-friendly interface for seamless interaction.
 
1
+ ---
2
+ license: apache-2.0
3
+ title: Fin Analyst
4
+ sdk: streamlit
5
+ emoji: πŸ“ˆ
6
+ colorFrom: green
7
+ colorTo: green
8
+ ---
9
+ # FinBuddy Project
10
+
11
+ ## Overview
12
+
13
+ FinBuddy is an AI Assistant designed to help users with questions related to financial metrics of Microsoft (MSFT), Tesla (TSLA), and Apple (AAPL). The project uses a combination of rule-based logic and machine learning models to provide answers in different formats such as text responses, tables, and charts. The application is built using Streamlit for the user interface and integrates with LangChain and Groq for the underlying AI functionalities.
14
+
15
+ ## Project Structure
16
+
17
+ The project consists of three main components:
18
+
19
+ 1. **main.py**: This script handles the core functionalities of the AI assistant, including initializing the language models, creating agents, and defining the conversation handling logic.
20
+ 2. **rule_based.py**: This script contains the rule-based logic for providing predefined answers to specific queries.
21
+ 3. **app.py**: This script sets up the Streamlit interface and integrates the rule-based and AI-driven responses.
22
+
23
+ ## File Descriptions
24
+
25
+ ### `main.py`
26
+ - **Imports and Initialization**: Sets up necessary imports, initializes the Groq client and model, and defines chat history.
27
+ - **Agent Creation**: Creates a CSV agent using LangChain's `create_csv_agent` function to handle queries related to financial metrics.
28
+ - **Functions**:
29
+ - `convo_agent`: Handles simple conversational queries.
30
+ - `csv_agent`: Processes financial queries and formats responses as tables, bar charts, or line charts.
31
+ - `run_conversation`: Manages the flow of the conversation by determining which function to use based on the user query.
32
+ - `get_response`: Processes the user query, interacts with the agents, and returns the appropriate response.
33
+ - `write_answer`: Formats and displays the response in Streamlit, including rendering tables and charts.
34
+
35
+ ### `rule_based.py`
36
+ - **simple_chatbot**: A simple rule-based chatbot that returns predefined answers for specific queries related to the total revenue of MSFT, AAPL, and TSLA for 2022 and 2023.
37
+
38
+ ### `app.py`
39
+ - **Streamlit Setup**: Initializes the Streamlit app, sets the title, and displays chat history.
40
+ - **Message Handling**: Captures user input, retrieves responses from the AI assistant or rule-based bot, and displays the responses.
41
+ - **Integration**: Integrates `get_response` from `main.py` and `simple_chatbot` from `rule_based.py` to handle user queries.
42
+
43
+ ## Project Flow
44
+
45
+ 1. **User Interaction**:
46
+ - The user interacts with the Streamlit app by typing a query into the chat input.
47
+
48
+ 2. **Message Capture**:
49
+ - The app captures the user's input and appends it to the chat history.
50
+
51
+ 3. **Response Generation**:
52
+ - The `get_response` function is called with the user query.
53
+ - `get_response` decides whether to use the `convo_agent` or `csv_agent` based on the nature of the query.
54
+ - The appropriate agent processes the query and returns the response.
55
+
56
+ 4. **Rule-Based Check**:
57
+ - Optionally, the response can be generated by the `simple_chatbot` for predefined queries if the rule-based option is enabled.
58
+
59
+ 5. **Response Display**:
60
+ - The response is formatted and displayed in the Streamlit app.
61
+ - If the response includes a table or chart, it is rendered accordingly.
62
+
63
+ 6. **Chat History Update**:
64
+ - The chat history is updated with the new user query and the AI response.
65
+
66
+ ## How to Run
67
+ Configuring Groq API
68
+ Create an API Key:
69
+
70
+ Visit the [Groq Console](https://console.groq.com/docs/api-reference#chat) and create an API key.
71
+
72
+ 1. Ensure you have the necessary dependencies installed:
73
+ ```bash
74
+ pip install -r requirements.txt
75
+ ```
76
+
77
+ 2. Run the Streamlit app:
78
+ ```bash
79
+ streamlit run app.py
80
+ ```
81
+
82
+ 3. Interact with the FinBuddy assistant through the Streamlit interface by typing queries related to the financial metrics of MSFT, TSLA, and AAPL.
83
+
84
+ Current this doesn't support Visualization or table, will be added in next iteration.
85
+
86
+ ## Conclusion
87
+
88
  FinBuddy is a robust AI assistant designed to help users with financial queries. By combining rule-based logic and advanced AI models, it provides accurate and formatted responses to a variety of questions. The use of Streamlit ensures a user-friendly interface for seamless interaction.