From e6ed06ed977208aeac2ba3b4ea82cfce6a8dc4a8 Mon Sep 17 00:00:00 2001 From: ShubhamSaboo Date: Mon, 17 Jun 2024 16:51:10 -0500 Subject: [PATCH] Added new demo --- README.md | 4 ++ ai_personal_finance_agent/README.md | 32 ++++++++++ ai_personal_finance_agent/finance_agent.py | 69 ++++++++++++++++++++++ ai_personal_finance_agent/requirements.txt | 4 ++ 4 files changed, 109 insertions(+) create mode 100644 ai_personal_finance_agent/README.md create mode 100644 ai_personal_finance_agent/finance_agent.py create mode 100644 ai_personal_finance_agent/requirements.txt diff --git a/README.md b/README.md index 0d6c3b2..3849006 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ A curated collection of awesome LLM apps built with RAG and AI agents. This repo - [💬 Chat with GitHub Repo](#-chat-with-github-repo) - [📈 AI Investment Agent](#-ai-investment-agent) - [🗞️ AI Journalist Agent](#-ai-journalist-agent) + - [💰 AI Personal Finance Agent](#-ai-personal-finance-agent) - [🛫 AI Travel Agent](#-ai-travel-agent) - [📰 Multi-Agent AI Researcher](#-multi-agent-ai-researcher) - [📄 Chat with PDF](#-chat-with-pdf) @@ -60,6 +61,9 @@ AI investment agent that compares the performance of two stocks and generates de ### 🗞️ AI Journalist Agent AI-powered journalist agent that generates high-quality articles using OpenAI GPT-4o. It automates the process of researching, writing, and editing articles, allowing you to create compelling content on any topic with ease. +### 💰 AI Personal Finance Agent +AI-powered personal finance planner that generates personalized financial plans using OpenAI GPT-4o. It automates the process of researching, planning, and creating tailored budgets, investment strategies, and savings goals. + ## 🛫 AI Travel Agent AI-powered travel Agent that generates personalized travel itineraries using OpenAI GPT-4o. It automates the process of researching, planning, and organizing your dream vacation, allowing you to explore exciting destinations with ease. diff --git a/ai_personal_finance_agent/README.md b/ai_personal_finance_agent/README.md new file mode 100644 index 0000000..92683af --- /dev/null +++ b/ai_personal_finance_agent/README.md @@ -0,0 +1,32 @@ +## 💰 AI Personal Finance Planner +This Streamlit app is an AI-powered personal finance planner that generates personalized financial plans using OpenAI GPT-4o. It automates the process of researching, planning, and creating tailored budgets, investment strategies, and savings goals, empowering you to take control of your financial future with ease. + +### Features +- Set your financial goals and provide details about your current financial situation +- Use GPT-4o to generate intelligent and personalized financial advice +- Receive customized budgets, investment plans, and savings strategies + +### How to get Started? + +1. Clone the GitHub repository + +```bash +git clone https://github.com/Shubhamsaboo/awesome-llm-apps.git +``` +2. Install the required dependencies: + +```bash +pip install -r requirements.txt +``` +3. Get your OpenAI API Key + +- Sign up for an [OpenAI account](https://platform.openai.com/) (or the LLM provider of your choice) and obtain your API key. + +4. Get your SerpAPI Key + +- Sign up for an [SerpAPI account](https://serpapi.com/) and obtain your API key. + +5. Run the Streamlit App +```bash +streamlit run finance_agent.py +``` \ No newline at end of file diff --git a/ai_personal_finance_agent/finance_agent.py b/ai_personal_finance_agent/finance_agent.py new file mode 100644 index 0000000..55be0a4 --- /dev/null +++ b/ai_personal_finance_agent/finance_agent.py @@ -0,0 +1,69 @@ +from textwrap import dedent +from phi.assistant import Assistant +from phi.tools.serpapi_tools import SerpApiTools +import streamlit as st +from phi.llm.openai import OpenAIChat + +# Set up the Streamlit app +st.title("AI Personal Finance Planner 💰") +st.caption("Manage your finances with AI Personal Finance Manager by creating personalized budgets, investment plans, and savings strategies using GPT-4o") + +# Get OpenAI API key from user +openai_api_key = st.text_input("Enter OpenAI API Key to access GPT-4o", type="password") + +# Get SerpAPI key from the user +serp_api_key = st.text_input("Enter Serp API Key for Search functionality", type="password") + +if openai_api_key and serp_api_key: + researcher = Assistant( + name="Researcher", + role="Searches for financial advice, investment opportunities, and savings strategies based on user preferences", + llm=OpenAIChat(model="gpt-4o", api_key=openai_api_key), + description=dedent( + """\ + You are a world-class financial researcher. Given a user's financial goals and current financial situation, + generate a list of search terms for finding relevant financial advice, investment opportunities, and savings strategies. + Then search the web for each term, analyze the results, and return the 10 most relevant results. + """ + ), + instructions=[ + "Given a user's financial goals and current financial situation, first generate a list of 3 search terms related to those goals.", + "For each search term, `search_google` and analyze the results.", + "From the results of all searches, return the 10 most relevant results to the user's preferences.", + "Remember: the quality of the results is important.", + ], + tools=[SerpApiTools(api_key=serp_api_key)], + add_datetime_to_instructions=True, + ) + planner = Assistant( + name="Planner", + role="Generates a personalized financial plan based on user preferences and research results", + llm=OpenAIChat(model="gpt-4o", api_key=openai_api_key), + description=dedent( + """\ + You are a senior financial planner. Given a user's financial goals, current financial situation, and a list of research results, + your goal is to generate a personalized financial plan that meets the user's needs and preferences. + """ + ), + instructions=[ + "Given a user's financial goals, current financial situation, and a list of research results, generate a personalized financial plan that includes suggested budgets, investment plans, and savings strategies.", + "Ensure the plan is well-structured, informative, and engaging.", + "Ensure you provide a nuanced and balanced plan, quoting facts where possible.", + "Remember: the quality of the plan is important.", + "Focus on clarity, coherence, and overall quality.", + "Never make up facts or plagiarize. Always provide proper attribution.", + ], + add_datetime_to_instructions=True, + add_chat_history_to_prompt=True, + num_history_messages=3, + ) + + # Input fields for the user's financial goals and current financial situation + financial_goals = st.text_input("What are your financial goals?") + current_situation = st.text_area("Describe your current financial situation") + + if st.button("Generate Financial Plan"): + with st.spinner("Processing..."): + # Get the response from the assistant + response = planner.run(f"Financial goals: {financial_goals}, Current situation: {current_situation}", stream=False) + st.write(response) diff --git a/ai_personal_finance_agent/requirements.txt b/ai_personal_finance_agent/requirements.txt new file mode 100644 index 0000000..549573b --- /dev/null +++ b/ai_personal_finance_agent/requirements.txt @@ -0,0 +1,4 @@ +streamlit +phidata +openai +google-search-results \ No newline at end of file