City entity for a weather chatbot

Hi, I am building a weather chatbot. I have a weather journey which is triggered by certain utterances. The bot asks which city we want to find weather for. Consider the example where user says something like - ‘I want to know the weather of Pune’. Here the user has already provided the name of the city. Now the weather API takes the city name as parameter. Now my question is, in this scenario how to define a ‘City’ entity and then also how to take it’s value from user utterance as it’s required in the API.

Just noticed that there is a global entity city. Any idea how to use that?
image

Hello @tejasvi_mangal, You can use the “Auto Skip” feature for prompt nodes in this scenario. Firstly, you must train the required cities under and Entity list. Now, when you look at the top right of the question node (Which city we want to find the weather of, in your case) you can find a “Make prompt smarter” option. Click on it and set Autoskip to the city entity list.

This enables the prompt node to automatically extract the relevant entity (“Pune” from your utterance) and this result could be stored in any variable via “Store response in” option. Hope this helps!

1 Like

Global entities are the Out of the box entities we provide for all bots. Locations, dates are automatically recognised as entities without being trained explicitly.

@Sriram_Pingali

Can I use this within a bot flow?
What would be the syntax to access this and assign to a variable inside the variable node?

Hi @gautham,
Are you asking to access the global entities from code?
Its under

prediction.global_entities

Yea, basically if I were the enter “whats the weather in Mumbai”, we’re getting Mumbai in the global entity.

I want to store that datapoint in a global variable.
Would prediction.global_entities.location be the right syntax?

prediction.global_entities

will be an array of objects.
If you have a property called label:city, pick up the text in which case syntax will be

prediction.global_entities[1].text
1 Like