diff --git a/README.md b/README.md index e88ca40..0d6c3b2 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 Travel Agent](#-ai-travel-agent) - [📰 Multi-Agent AI Researcher](#-multi-agent-ai-researcher) - [📄 Chat with PDF](#-chat-with-pdf) - [💻 Web Scraping AI Agent](#-web-scraping-ai-agent) @@ -59,6 +60,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 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. + ### 📰 Multi-Agent AI Researcher Use a team of AI agents to research top HackerNews stories and users with GPT-4 to generate blog posts, reports, and social media content on autopilot. diff --git a/ai_journalist_agent/journalist_agent.py b/ai_journalist_agent/journalist_agent.py index 40f7a80..48bde3b 100644 --- a/ai_journalist_agent/journalist_agent.py +++ b/ai_journalist_agent/journalist_agent.py @@ -78,7 +78,6 @@ if openai_api_key and serp_api_key: "Remember: you are the final gatekeeper before the article is published.", ], add_datetime_to_instructions=True, - # debug_mode=True, markdown=True, ) diff --git a/ai_travel_agent/README.MD b/ai_travel_agent/README.MD new file mode 100644 index 0000000..9117ad7 --- /dev/null +++ b/ai_travel_agent/README.MD @@ -0,0 +1,38 @@ +## 🛫 AI Travel Agent +This Streamlit app is an 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. + +### Features +- Research and discover exciting travel destinations, activities, and accommodations +- Customize your itinerary based on the number of days you want to travel +- Utilize the power of GPT-4o to generate intelligent and personalized travel plans + +### 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 travel_agent.py +``` + +### How it Works? + +The AI Travel Agent has two main components: +- Researcher: Responsible for generating search terms based on the user's destination and travel duration, and searching the web for relevant activities and accommodations using SerpAPI. +- Planner: Takes the research results and user preferences to generate a personalized draft itinerary that includes suggested activiti \ No newline at end of file diff --git a/ai_travel_agent/requirements.txt b/ai_travel_agent/requirements.txt new file mode 100644 index 0000000..549573b --- /dev/null +++ b/ai_travel_agent/requirements.txt @@ -0,0 +1,4 @@ +streamlit +phidata +openai +google-search-results \ No newline at end of file diff --git a/ai_travel_agent/travel_agent.py b/ai_travel_agent/travel_agent.py new file mode 100644 index 0000000..5a3fee6 --- /dev/null +++ b/ai_travel_agent/travel_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 Travel Planner ✈️") +st.caption("Plan your next adventure with AI Travel Planner by researching and planning a personalized itinerary on autopilot 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 travel destinations, activities, and accommodations based on user preferences", + llm=OpenAIChat(model="gpt-4o", api_key=openai_api_key), + description=dedent( + """\ + You are a world-class travel researcher. Given a travel destination and the number of days the user wants to travel for, + generate a list of search terms for finding relevant travel activities and accommodations. + Then search the web for each term, analyze the results, and return the 10 most relevant results. + """ + ), + instructions=[ + "Given a travel destination and the number of days the user wants to travel for, first generate a list of 3 search terms related to that destination and the number of days.", + "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 draft itinerary based on user preferences and research results", + llm=OpenAIChat(model="gpt-4o", api_key=openai_api_key), + description=dedent( + """\ + You are a senior travel planner. Given a travel destination, the number of days the user wants to travel for, and a list of research results, + your goal is to generate a draft itinerary that meets the user's needs and preferences. + """ + ), + instructions=[ + "Given a travel destination, the number of days the user wants to travel for, and a list of research results, generate a draft itinerary that includes suggested activities and accommodations.", + "Ensure the itinerary is well-structured, informative, and engaging.", + "Ensure you provide a nuanced and balanced itinerary, quoting facts where possible.", + "Remember: the quality of the itinerary 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 destination and the number of days they want to travel for + destination = st.text_input("Where do you want to go?") + num_days = st.number_input("How many days do you want to travel for?", min_value=1, max_value=30, value=7) + + if st.button("Generate Itinerary"): + with st.spinner("Processing..."): + # Get the response from the assistant + response = planner.run(f"{destination} for {num_days} days", stream=False) + st.write(response) \ No newline at end of file