finbot ai record
finbot ai record
To develop an AI-powered chatbot, FinBot, that assists users in making informed financial
decisions by providing personalized guidance on budgeting, saving, investing, credit
management, debt repayment, and retirement planning, tailored to various user roles such as
investors, savers, borrowers, and financial planners.
Description:
FinBot is a comprehensive AI-powered chatbot integrated into a personal finance application,
designed to support users in managing their finances and making informed financial choices.
Developed using cutting-edge technologies like Natural Language Processing (NLP), machine
learning, and contextual AI models (e.g., Rasa, ChatGPT API), FinBot provides round-the-clock
support to users involved in various aspects of personal finance.
The core purpose of FinBot is to bridge the communication and knowledge gap between
individuals and financial services by offering instant, personalized assistance. By
understanding the user's intent and context, FinBot delivers intelligent responses and
actionable financial advice.
1. Investor:
FinBot helps users evaluate investment opportunities, offers tips on diversifying
portfolios, explains stock market basics, and provides market insights. It assists with
selecting ETFs, index funds, and understanding risk levels, all while encouraging smart,
long-term investment strategies.
2. Saver:
FinBot provides personalized saving tips, helps users set financial goals, and advises on
emergency funds. It offers methods to automate savings, track spending, and identify
areas for potential savings, ensuring that users are always on track to meet their
financial objectives.
3. Borrower:
Borrowers can use FinBot to understand different loan types (e.g., personal, mortgage,
student loans), compare interest rates, and explore repayment strategies. The bot also
provides tips on improving credit scores and avoiding high-interest debt, ensuring
borrowers make sound financial decisions.
4. Financial Planner:
FinBot assists financial planners in creating long-term financial strategies for their
clients. It offers tools for retirement planning, tax filing advice, and estate planning,
helping planners optimize financial portfolios for future security.
5. Credit: Manager:
FinBot helps users manage credit, offering advice on improving credit scores,
understanding credit reports, and managing credit card usage. It also provides
guidance on utilizing credit responsibly to maintain financial health and avoid falling
into debt.
Universal Features:
In addition to role-specific support, FinBot includes universal features accessible by all users:
Technology Stack:
• OpenAI GPT API for dynamic financial guidance (e.g., budgeting advice, investment
tips)
• Geo APIs for location-based financial assistance (e.g., finding financial advisors)
Impact:
FinBot supports SDG 1 (No Poverty) and SDG 8 (Decent Work and Economic Growth) by
enhancing financial literacy and empowering users to manage their finances. It helps users
achieve financial independence, reduce debt, and plan for retirement, fostering financial
stability and contributing to sustainable economic growth.
PROGRAM CODE:
import random
import re
import json
import os
app = Flask(__name__)
knowledge_base = {
"greetings": [
"Hello! I'm FinBot, your personal financial assistant. How can I help you today?",
"Welcome! I'm FinBot. Whether it's budgeting or investing, I've got you covered."
],
"farewells": [
],
"thanks": [
],
"identity": [
"I'm FinBot, your smart assistant for all things personal finance — budgeting, investing,
saving, and more!",
"FinBot here! I help you understand and improve your financial life.",
],
"budgeting_tips": [
"A 50/30/20 budget rule is a great starting point: 50% needs, 30% wants, 20% savings.",
"Tracking every expense for a month can uncover surprising spending habits.",
],
"emergency_fund": [
"Keep your emergency fund in a high-yield savings account for easy access and growth.",
"Unexpected events happen — your emergency fund gives you peace of mind."
],
"saving_tips": [
"Cut small daily costs like takeout coffee to save more over time."
],
"investment_basics": [
"Investing means putting your money to work for potential future returns.",
"Start with index funds or ETFs — they offer diversification and lower risk.",
"Only invest money you can leave untouched for at least 5 years."
],
"stock_vs_bonds": [
"Stocks are ownership in companies; bonds are loans you give to governments or
corporations.",
"Stocks are higher risk, higher reward. Bonds are more stable but usually lower returns."
],
"mutual_funds": [
"They are managed by professionals and are a great way to diversify easily."
],
"credit_score_basics": [
"A credit score reflects how reliably you manage debt. Higher scores mean better rates.",
"Pay bills on time, keep credit utilization low, and limit hard inquiries to improve your score."
],
"loan_types": [
"Each loan type has its own interest rates, term lengths, and approval criteria."
],
"debt_repayment_strategies": [
"Snowball method: pay smallest debts first. Avalanche method: pay highest interest first.",
"Always pay more than the minimum if you can to reduce interest."
],
"tax_filing_tips": [
"File your taxes early to avoid stress and reduce identity theft risks.",
"Keep all income and expense records organized throughout the year.",
],
"insurance_basics": [
"Insurance protects you from big financial losses — health, auto, home, and life are key
types.",
],
"retirement_planning": [
"Start retirement savings early to benefit from compound growth.",
"401(k)s and IRAs are great retirement vehicles with tax advantages.",
],
"compound_interest": [
"Compound interest means you earn interest on your interest. It’s the key to growing
wealth.",
"The earlier you start saving, the more time compounding works in your favor."
],
"financial_goals": [
],
"student_loans": [
"Know the difference between federal and private loans — repayment options differ.",
],
"credit_card_tips": [
"Pay off your credit card balance in full each month to avoid interest.",
"Use less than 30% of your credit limit to maintain a good credit score."
],
"mortgage_tips": [
"A fixed-rate mortgage offers predictable payments. An ARM may be cheaper short-term.",
],
"fraud_prevention": [
"financial_literacy": [
"Financial literacy means understanding how to manage money, debt, and investments
wisely.",
"Improving your financial knowledge leads to better decisions and financial freedom."
],
"unknown": [
"Hmm, I didn't quite catch that. Could you ask about savings, budgeting, or investing?",
"I'm still learning. Could you rephrase or try a finance-related topic like loans or
retirement?",
"Let’s stay on money matters. Ask me about credit, savings, debt, or financial planning!"
],
"learned_responses": []
def preprocess_text(text):
text = text.lower().strip()
return text
if os.path.exists('ecobot_knowledge_base.json'):
knowledge_base = json.load(f)
else:
json.dump(knowledge_base, f, indent=4)
user_info = {
"current_role": "unknown",
"waste_type": None
def detect_intent(user_input):
user_input = preprocess_text(user_input)
print(user_input)
# Basic interactions
if re.search(r'\b(hi|hello|hey|greetings)\b', user_input):
return "greetings"
return "farewells"
return "thanks"
return "identity"
return "emergency_fund"
return "saving_tips"
return "investment_basics"
return "stock_vs_bonds"
return "mutual_funds"
return "credit_score_basics"
return "loan_types"
return "debt_repayment_strategies"
return "tax_filing_tips"
return "insurance_basics"
return "retirement_planning"
return "compound_interest"
return "financial_goals"
elif re.search(r'\b(student loan|college debt|education loan)\b', user_input):
return "student_loans"
return "credit_card_tips"
return "mortgage_tips"
return "fraud_prevention"
return "financial_literacy"
# Default fallback
return "unknown"
def generate_response(user_input):
intent = detect_intent(user_input)
print(intent)
if intent in knowledge_base:
reply = random.choice(knowledge_base[intent])
print(reply)
return reply
# Default response
return random.choice(knowledge_base["unknown"])
# Conversation context (simplified)
conversation_context = {
"learning_mode": False,
"question_to_learn": "",
"last_user_input": ""
def process_message(user_input):
global conversation_context
if conversation_context["learning_mode"]:
conversation_context["learning_mode"] = False
elif conversation_context["question_to_learn"]:
knowledge_base["learned_responses"][conversation_context["question_to_learn"]] =
user_input
json.dump(knowledge_base, f, indent=4)
conversation_context["learning_mode"] = False
conversation_context["question_to_learn"] = ""
return "Thank you for teaching me! I'll remember that for future sustainability
discussions."
conversation_context["last_user_input"] = user_input
response = generate_response(user_input)
if response == "I don't know the answer to that eco-question yet. Would you like to teach
me? (yes/no)":
conversation_context["learning_mode"] = True
return response
@app.route("/")
def home():
return render_template("index.html")
@app.route("/get_response", methods=["POST"])
def get_response():
user_input = request.json.get("message")
bot_reply = process_message(user_input)
if __name__ == "__main__":
app.run(debug=True)
SCREENSHOTS:
RESULT: