3. Main Workflow Steps
1
Get Weather Data
Understanding the use of the _ Variable in iteration steps
Understanding the use of the _ Variable in iteration steps
When used inside a
map
or a foreach
step, the _
variable is a reference to the current value in the iteration.For example:- Iterates over each location in the input array
- Calls the weather API for each location
2
Search for Tourist Attractions
- Iterates over the locations again
- Searches for tourist attractions in each location
- Constructs a search query by concatenating “tourist attractions in ” with the location
3
Combine Data
- Combines the data from previous steps into tuples
- Each tuple contains: (location, weather_data, attractions_data)
- Uses Python’s
zip
function to align the data
4
Generate Itineraries
- Processes up to 3 locations in parallel
- For each location tuple:
- Sends a prompt to the AI model
- Includes location, weather, and attraction data
- Generates a personalized itinerary
5
Format Final Output
- Combines all itineraries into a single output
- Separates each itinerary with a divider
Complete Task YAML
Complete Task YAML
YAML