Personalization — GPT & Context
Personalization has become a critical aspect of customer engagement. From personalized shopping experiences to content recommendations, delivering personalized experiences is what sets successful products apart. But how do we achieve personalization via RAG & Gen AI?
Note: To practically demonstrate, I will focus only on GPT-4o inputs and outputs with user context to demonstrate personalized responses.
User intent: Lets assume a user is looking for an intent — “Recommend a destination in India.”
We will try various GPT prompts by adding context step by step.
Crawl State: Zero/No Personalization
GPT-4o Prompt:
You are a travel recommendation system for India. Suggest a popular Indian destination.
User: Recommend a destination in India.
GPT-4o Response:
I recommend Jaipur, Rajasthan as a destination in India. It’s known as the “Pink City” and is famous for its stunning palaces, colorful bazaars, and rich cultural heritage.
Walk State: Basic Context Personalization
Adding Basic User Context:
Name: Priya
Age: 28
Previous trips: Goa, Kerala
Interests: History, Cuisine
GPT-4o Prompt:
You are a travel recommendation system for India. Use the provided user information to suggest a personalized Indian destination.
User Information:
- Name: Priya
- Age: 28
- Previous trips: Goa, Kerala
- Interests: History, Cuisine
User: Recommend an Indian destination for me.
GPT-4o Response:
Based on your interests in history and cuisine, and considering your previous trips to Goa and Kerala, I recommend Lucknow, Uttar Pradesh for your next vacation. Lucknow, known as the “City of Nawabs,” offers a perfect blend of historical significance and culinary delights. You can explore architectural marvels like the Bara Imambara and Rumi Darwaza, while indulging in the famous Awadhi cuisine, including kebabs, biryani, and tunday kababi. This destination will provide a different experience from your coastal trips to Goa and Kerala, allowing you to delve into North Indian history and gastronomy.
Run State: Basic Context + Recent activity
Input:
Previous information +
Recent searches: “Best street food in India”, “Mughal architecture”
Last watched video: “Top 10 Heritage Sites in India”
GPT-4o Prompt:
You are an advanced travel recommendation system for India. Use the provided user information, including recent activity, to suggest a highly personalized Indian destination.
User Information:
- Name: Priya
- Age: 28
- Previous trips: Goa, Kerala
- Interests: History, Cuisine
- Recent searches: "Best street food in India", "Mughal architecture"
- Last watched video: "Top 10 Heritage Sites in India"
User: Considering my recent interests, where should I go for my next vacation in India?
GPT-4o Response:
Given your longstanding interest in history and cuisine, combined with your recent searches about Indian street food and Mughal architecture, as well as your interest in heritage sites, I highly recommend a trip to Delhi.
Delhi, the capital city, offers a perfect blend of historical significance, architectural marvels, and culinary delights. You can explore Mughal architectural wonders like the Red Fort and Humayun’s Tomb, both UNESCO World Heritage Sites. The city is also famous for its street food, especially in areas like Chandni Chowk, where you can sample delicacies like chaat, parathas, and kebabs.
Delhi’s mix of Old and New Delhi provides a unique perspective on Indian history, from ancient times to the colonial era and modern India. You can visit other historical sites like Qutub Minar and Jama Masjid, satisfying your interest in heritage sites.
This destination aligns perfectly with your recent interests while offering a different experience from your previous trips to Goa and Kerala, allowing you to explore North Indian history, architecture, and cuisine.
Fly State: Basic Context + Recent activity + Real-time Context
Input:
Previous information +
Current season: Monsoon (July)
Real-time flight prices: Delhi (expensive), Kolkata (moderate), Amritsar (cheap)
Local events: Kolkata hosting a major Food Festival next month
Prompt:
You are a cutting-edge travel recommendation system for India. Use all available information, including real-time data, to provide the most relevant and timely vacation suggestion in India.
User Information:
- Name: Priya
- Age: 28
- Previous trips: Goa, Kerala
- Interests: History, Cuisine
- Recent searches: "Best street food in India", "Mughal architecture"
- Last watched video: "Top 10 Heritage Sites in India"
- Current season: Monsoon (July)
- Real-time flight prices: Delhi (expensive), Kolkata (moderate), Amritsar (cheap)
- Local events: Kolkata hosting a major Food Festival next month
User: What's the best vacation option for me in India right now, considering all factors?
GPT-4o Response:
Considering all the factors, including your interests, recent activities, current season, and real-time information, I highly recommend Kolkata, West Bengal as your next vacation destination in India.
Here’s why Kolkata is the perfect choice for you right now:
1. Culinary Delight: Kolkata is renowned for its diverse and delicious cuisine. The upcoming major Food Festival aligns perfectly with your interest in Indian cuisine and recent searches for street food. You’ll have the opportunity to taste a wide variety of Bengali dishes and street food specialties.
2. Rich History: Kolkata, formerly the capital of British India, is steeped in history. You can explore historical sites like Victoria Memorial, Indian Museum (the oldest and largest museum in India), and Howrah Bridge, satisfying your interest in Indian heritage.
3. Architectural Marvels: While not Mughal architecture, Kolkata boasts impressive colonial-era buildings and Bengali terracotta temples, offering a different but equally fascinating architectural experience.
4. Value for Money: With moderate flight prices compared to Delhi, and considering the special food festival event, Kolkata offers excellent value for your trip.
5. Monsoon Experience: July is monsoon season in Kolkata, which gives the city a unique charm. The rain brings out the lush greenery, and you can enjoy the famous Bengali monsoon delicacies like khichuri and ilish maach.
6. Cultural Immersion: Kolkata is known as the cultural capital of India. You can visit places like College Street (largest book market in India), enjoy Bengali theatre, and experience the city’s rich literary and artistic heritage.
7. Unique Experience: Kolkata offers a distinct flavor of Eastern India, quite different from your previous trips to Goa and Kerala, as well as from North Indian cities like Delhi or Amritsar.
By choosing Kolkata, you’ll get a perfect blend of your interests in history and cuisine, take advantage of the special Food Festival event, and enjoy a new city that offers good value for money during the monsoon season. The moderate flight prices make it more attractive than the currently expensive Delhi, while the unique culinary event gives it an edge over the cheaper Amritsar option.
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
“The more context you provide to GPT, the better the personalized response”
Basic RAG systems, which combine a retriever and a generator, are great for improving the quality and relevance of responses from large language models (LLMs). However, they struggle in providing personalized recommendations & answers because the retrieved content lack specific user context.
Adding Context in the RAG Pipeline
To tackle this, we need to augment RAG with context into the retrieval pipeline. This involves two key components:
- Context of additional attributes (ex: Locations): When recommending a city, the model should be aware of details like current weather, local activities, famous cuisines, and historical sites. This information helps users plan their trips more effectively.
- User Personalized Context: This includes information about the user’s preferences, such as their interest in history, preferred climate, and accommodation type. By combining this user-specific context with the surrounding context, the AI model can provide highly tailored recommendations.
By integrating contexts, RAG enhances the personalization of its suggestions & responses, delivering a more relevant and useful response personalized to each individual user.
Posted on: Tue Jun 25 2024