Spaces:
Runtime error
Runtime error
| """ | |
| Financial Advisor domain template. | |
| """ | |
| from typing import List | |
| from .base_domain import BaseDomain | |
| class FinancialAdvisorDomain(BaseDomain): | |
| """ | |
| Financial advisory domain for wealth management, | |
| investment planning, tax strategy, and retirement planning. | |
| """ | |
| def __init__(self): | |
| super().__init__() | |
| self._name = "Financial Advisor" | |
| self._description = "Expert financial advisory assistant for wealth management, investment planning, tax strategy, retirement planning, and estate planning." | |
| self._icon = "$" | |
| def get_topics(self) -> List[str]: | |
| """Get financial advisory topics""" | |
| return [ | |
| "Retirement Planning", | |
| "Investment Strategy", | |
| "Tax Optimization", | |
| "Estate Planning", | |
| "Insurance Planning", | |
| "Education Funding", | |
| "Portfolio Management", | |
| "Asset Allocation", | |
| "Risk Management", | |
| "Wealth Preservation", | |
| "Stock Market Analysis", | |
| "Bond Investing", | |
| "Real Estate Investment", | |
| "Cryptocurrency Investment", | |
| "401(k) and IRA Planning", | |
| "Social Security Optimization", | |
| "Debt Management", | |
| "Emergency Fund Planning", | |
| "College Savings (529 Plans)", | |
| "Trust and Will Creation", | |
| "Charitable Giving", | |
| "Business Succession Planning", | |
| "Financial Independence (FIRE)", | |
| "Dividend Investing", | |
| "Value Investing", | |
| "Growth Investing", | |
| "Index Fund Investing", | |
| "Municipal Bonds", | |
| "Treasury Securities", | |
| "Annuities", | |
| "Life Insurance", | |
| "Disability Insurance", | |
| "Long-Term Care Insurance", | |
| "Health Savings Accounts (HSA)", | |
| "Roth Conversions", | |
| "Capital Gains Tax Planning", | |
| "Required Minimum Distributions (RMD)", | |
| "Pension Planning", | |
| "Rollover Strategies", | |
| "Beneficiary Designations", | |
| "Power of Attorney" | |
| ] | |
| def get_system_prompt(self) -> str: | |
| """Get financial advisor system prompt""" | |
| return """You are an expert financial advisor with comprehensive knowledge of: | |
| - Wealth management and investment planning | |
| - Retirement planning (401k, IRA, pensions, Social Security) | |
| - Tax optimization strategies and tax-advantaged accounts | |
| - Estate planning (wills, trusts, beneficiary designations) | |
| - Insurance planning (life, disability, long-term care) | |
| - Portfolio management and asset allocation | |
| - Risk assessment and management | |
| - Financial regulations and compliance | |
| Your role is to: | |
| 1. Provide clear, actionable financial guidance | |
| 2. Consider the client's complete financial picture | |
| 3. Explain complex financial concepts in simple terms | |
| 4. Recommend appropriate investment strategies based on risk tolerance and goals | |
| 5. Stay up-to-date on tax laws and financial regulations | |
| 6. Always remind clients to consult with licensed professionals for personalized advice | |
| Guidelines: | |
| - Be thorough but concise | |
| - Always consider tax implications | |
| - Emphasize diversification and risk management | |
| - Explain the reasoning behind recommendations | |
| - Use specific numbers and examples when helpful | |
| - Acknowledge when questions require personalized professional advice | |
| - Stay objective and avoid conflicts of interest | |
| Remember: You provide educational information and general guidance. Always recommend clients work with licensed financial professionals for personalized advice tailored to their specific situation.""" | |
| def get_example_questions(self) -> List[str]: | |
| """Get example financial advisory questions""" | |
| return [ | |
| "Should I max out my 401(k) or invest in a taxable brokerage account?", | |
| "How should I allocate my portfolio at age 35 with moderate risk tolerance?", | |
| "What's the difference between a traditional IRA and a Roth IRA?", | |
| "How much should I have in my emergency fund?", | |
| "When should I start taking Social Security benefits?", | |
| "What are the tax implications of selling stocks at a gain?", | |
| "How do I plan for required minimum distributions (RMDs)?", | |
| "Should I pay off my mortgage early or invest the extra cash?", | |
| "What's the best way to save for my child's college education?", | |
| "How do I create an estate plan that minimizes taxes?" | |
| ] | |
| def get_specialized_tools(self) -> List[dict]: | |
| """Get financial advisory tools""" | |
| return [ | |
| { | |
| "name": "get_market_data", | |
| "description": "Fetch current market data for stocks, bonds, ETFs, or indices", | |
| "parameters": { | |
| "symbol": "string (ticker symbol)", | |
| "data_type": "string (price, volume, fundamentals, historical)" | |
| }, | |
| "returns": "Market data object with current prices and metrics" | |
| }, | |
| { | |
| "name": "calculate_compound_interest", | |
| "description": "Calculate compound interest growth over time", | |
| "parameters": { | |
| "principal": "float (initial investment)", | |
| "rate": "float (annual interest rate as decimal)", | |
| "time": "int (years)", | |
| "frequency": "int (compounding frequency per year)" | |
| }, | |
| "returns": "float (future value)" | |
| }, | |
| { | |
| "name": "calculate_retirement_needs", | |
| "description": "Estimate retirement savings needed based on goals", | |
| "parameters": { | |
| "current_age": "int", | |
| "retirement_age": "int", | |
| "life_expectancy": "int", | |
| "desired_annual_income": "float", | |
| "current_savings": "float", | |
| "expected_return": "float" | |
| }, | |
| "returns": "Retirement projection object" | |
| }, | |
| { | |
| "name": "analyze_portfolio_allocation", | |
| "description": "Analyze portfolio allocation and risk metrics", | |
| "parameters": { | |
| "holdings": "list of {symbol, quantity, purchase_price}", | |
| "target_allocation": "dict of asset class targets" | |
| }, | |
| "returns": "Portfolio analysis with allocation drift and recommendations" | |
| }, | |
| { | |
| "name": "estimate_tax_impact", | |
| "description": "Estimate tax impact of financial decisions", | |
| "parameters": { | |
| "income": "float", | |
| "transaction_type": "string (capital_gain, dividend, withdrawal, etc.)", | |
| "amount": "float", | |
| "filing_status": "string" | |
| }, | |
| "returns": "Tax estimate object" | |
| }, | |
| { | |
| "name": "get_social_security_estimate", | |
| "description": "Estimate Social Security benefits based on earnings history", | |
| "parameters": { | |
| "birth_year": "int", | |
| "average_annual_income": "float", | |
| "claiming_age": "int" | |
| }, | |
| "returns": "Estimated monthly benefit" | |
| } | |
| ] | |