Teneo Developers

Share to

Weather

The Weather solution contains a weather flow that gets either the current weather or forecast for a city using the free weather api from MetaWeather.

weather

Core concepts

  • Integration
  • External weather service
  • Slot filling
  • Date handling
  • Topic handling
  • Listeners

Example conversations

User: What is the weather like?
Bot: For which city?

User: Amsterdam
Bot: On 10 Dec 2018 the weather will be Light Cloud and 16°C in Amsterdam.

User: What is the weather like in Amsterdam?
Bot: On 10 Dec 2018 the weather will be Light Cloud and 16°C in Amsterdam.

User: What will the weather be like in Amsterdam tomorrow?
Bot: On 11 Dec 2018 the weather will be Showers and 15°C in Amsterdam.

User: What is the forecast for Thursday
Bot: For which city?

User: London
Bot: On 13 Dec 2018 the weather will be Light Cloud and 3°C in London.

User: What's the forecast?
Bot: For which city?

User: Paris
Bot: On 10 Dec 2018 the weather will be Light Cloud and 8°C in Paris.

User: What is the weather like in Stockholm
Bot: On 10 Dec 2018 the weather will be Heavy Cloud and -1°C in Stockholm.

User: What about tomorrow?
Bot: On 11 Dec 2018 the weather will be Showers and 2°C in Stockholm.

User: What about London?
Bot: On 11 Dec 2018 the weather will be Light Cloud and 6°C in London.

User: How about today?
Bot: Response On 10 Dec 2018 the weather will be Heavy Cloud and 7°C in London.

User: Do I need an umbrella today?
Bot: For which city?

User: Helsinki
Bot: You will not need your umbrella today. The weather will be Heavy Cloud and 2°C in Helsinki.

User: How about tomorrow?
Bot: You will need your umbrella tomorrow. The weather will be Showers and 2°C in Helsinki.

Solution components

NameTypeDescription
WeatherFolderA folder that holds sub-folders for the flows and entities in this solution.
Weather flowFlowA slot filling flow in which allows the user to get the weather by city and day. If no day is mentioned in the user input, the get Date time script in the flow will assume that it is for ‘today’ that the user wants the weather for, by creating a ‘default’ date representation.
WEATHER_ACCESSORIES.ENTITYEntityEntity containing weather accessories SUNGLASSES.NN.LEX, UMBRELLA.NN.LEX and RAINCOAT.NN.LEX. Also contains two NLU variables: ’weatherType’ which holds the type of weather and 'weatherAccessory' which holds the name of the accessory.
WEATHER_CITIES.ENTITYEntityEntity containing CITY.ENTITY and LOCATION.ENTITY (both exist in the English TLR). Also contains an NLU variable called 'cityName' which holds the value of the city as a string.
Weather integrationIntegrationAn integration that contains the method ‘Get weather’ which gets the weather description for a city during the given day. The weather service MetaWeather is used to get the weather.
weatherTemperatureScaleGlobal variableUsed for controlling which temperature scale to use. Contains one letter ‘C’ for Celsius. Change the ‘C’ to an ‘F’ to get Fahrenheit.
weatherDateGlobal variableUsed to remember the date to allow follow-up questions.
weatherCityGlobal variableUsed to remember the city to allow follow-up questions.
weatherTopicGlobal variableUsed to set topic of the conversation to 'weather' and context restrict the follow-up triggers.
weatherAccessoryNameGlobal variableUsed to remember the weather accessory name to allow follow-up questions.
weatherAccessoryTypeGlobal variableUsed to remember the weather accessory 'type' to allow follow-up questions.
Weather Syntax TriggersOrder GroupThis is an order group for syntax triggers used by the solution.

Make sure you check for possible conflicts before you import this solution into an existing solution (merge solutions).

Download

  1. Download the solution Weather.
  2. Import the solution into Teneo studio. We recommend you to import it into a solution that is based on the Teneo Dialogue Resources English.
  3. Disable the flow 'The user comments on the weather' in the folder 'Dialogue' -> 'Conversational' -> 'Conversation'. Otherwise, this flow will steal inputs from the solution you are about to import.

Note that the MetaWeather API supports a limited set of cities. Also bear in mind that since it is a free API, you should limit the number of API requests. If you are planning to use a weather API in a production environment, we advise you to look for commercial alternatives.