How to extract entities from 'bot sends' in wit.ai

145 views Asked by At

I have a scenario like this

User says: What's the temperature in SF?
bot executes: get_forecast
updates context with: forecast
bot send: {forecast}

Is there a way to use {forecast} and extract entities from it? For example, I can continue the above story as -

User say: convert that in celsius
<extract temperature from {forecast} set entities>
bot execute: convert_to_celsius
updates context with: temperature
bot sends: {temperature}

Any suggestions on how to do this?

1

There are 1 answers

0
JusQ On

The entity value can be stored in context, or on your backend/server.

If you store {forecast} in context, when user request conversion to celsius, you retrieve it from context, convert it and update context with {temperature}.

However, note that 'context' is passed around between user and your backend so I do not recommend putting too many unnecessary values in it, due to more data being transmitted for each call.

For your use case, you could storing {forecast} on your server instead. When user request conversion, simply retrieve it and update context.