Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def financial_advisor_chatbot(customer_data, conversation_history, user_input):
- prompt = f"""
- You are a financial advisor chatbot for a bank. Use the following customer data and conversation history to provide personalized financial advice:
- Customer Data:
- - Income: ${customer_data['income']}
- - Savings: ${customer_data['savings']}
- - Debt: ${customer_data['debt']}
- - Financial Goals: {', '.join(customer_data['financial_goals'])}
- Conversation History:
- {conversation_history}
- Customer's Latest Question: {user_input}
- Provide a personalized response that addresses the customer's question and offers relevant financial advice based on their profile.
- """
- response = llm.generate(prompt)
- return response.text
- # Example usage
- customer = {
- "income": 75000,
- "savings": 50000,
- "debt": 20000,
- "financial_goals": ["buy a house", "save for retirement"]
- }
- conversation_history = [
- "Customer: What's the best way to save for a down payment on a house?",
- "Bot: Based on your current savings and income, I'd recommend...",
- "Customer: How much should I be saving each month?",
- "Bot: Considering your goal to buy a house and save for retirement..."
- ]
- user_input = "Should I focus on paying off my debt or saving for a house down payment?"
- response = financial_advisor_chatbot(customer, conversation_history, user_input)
- print(response)
Advertisement
Add Comment
Please, Sign In to add comment