What is the best way to have variables for storing values for each conversation?


I have a form which is working fine but I want to have some “variables” I want to use for storing additional calculated values I will use in the final output.

Can somebody guide me on the best way to manage “session” or “conversation” variables for each conversation? I thought slots as a way of temporarily storing this information but couldn’t see an easy way of simply updating a key/value pair for slots. Any guidance really appreciated.

Kind regards

After some more investigation I have noticed you can use “SetSlot” when using an action (populating the return).

Is there a way of setting a slot value in a middle of slot validation code. Using SlotSet(’’,value) doesn’t work when I call it directly.

Hi @pomegran, when you quite a validation action, the validate_{slot_name} function returns a dictionary of slot names and values. While this is commonly used to update the value of that specific slot_name slot, you can also update other values as well. An example of that can be found here.

Perfect! I’d figured it out using good old hacking (!) so nice to see solution was inline with yours, thank you.

Wish there was a ‘tracker.set_slot’ method :stuck_out_tongue_winking_eye:

Many thanks