An intelligent travel planning system that generates optimized daily schedules and recommendations for travelers in Busan using LangChain and multiple AI agents.
- Dual-Agent System:
- Schedule Generator: Crafts detailed daily itineraries based on attraction visit times.
- Recommendation Generator: Offers contextual travel tips and weather precautions.
- Weather-Aware Planning: Adapts to temperature, air quality, and weather conditions.
- Dynamic Scheduling: Adjusts plans for optimal travel experiences.
- GPU Acceleration: Supports M1 Macs with Metal Performance Shaders (MPS).
- Python 3.7+
- PyTorch
- LangChain
- Ollama
-
Clone the repository:
git clone https://github.com/Valiev-Koyiljon/LLM_TOUR_RECOMMENDATION.git cd LLM_TOUR_RECOMMENDATION
-
Install required packages:
pip install torch langchain ollama
-
Install Ollama and download the llama3.2 model:
# Install Ollama (varies by OS) curl https://ollama.ai/install.sh | sh # Pull the model ollama pull llama3.2
The system processes weather data and attraction information to create personalized travel plans. Here's an example:
# Sample data
data = [{
"date": "2024-10-05",
"temp_high": 30,
"temp_low": 14,
"weather": "Windy",
"air_quality": "Hazardous",
"attractions": [
{"name": "Haeundae Beach", "recommended_time": 2.98},
{"name": "Gwangalli Beach", "recommended_time": 3.18},
{"name": "Taejongdae", "recommended_time": 3.63},
{"name": "Beomeosa Temple", "recommended_time": 2.4},
{"name": "Gamcheon Culture Village", "recommended_time": 1.0}
]
}]
# Initialize agent and process the data
agent = initialize_agent(tools, llm, agent=AgentType.OPENAI_FUNCTIONS, verbose=True)
for entry in data:
result = process_prompt(agent, entry["date"], entry["temp_high"],
entry["temp_low"], entry["weather"],
entry["air_quality"], entry["attractions"])
print(result)
The system leverages two key AI agents:
-
Schedule Generator
- Designs efficient daily schedules.
- Considers weather and attraction visit times.
- Optimizes visit order for convenience.
-
Recommendation Generator
- Provides weather-specific advice.
- Recommends precautions based on air quality.
- Shares tips to enhance travel enjoyment.
Input data should follow this JSON structure:
{
"date": "YYYY-MM-DD",
"temp_high": float,
"temp_low": float,
"weather": string,
"air_quality": string,
"attractions": [
{
"name": string,
"recommended_time": float
}
]
}
- GPU acceleration is enabled for M1 Macs via MPS.
- The system utilizes the llama3.2 model through Ollama.
- Agent verbosity is adjustable during initialization.