Getting slot values from a conversation with sender id

Hi, I have a use case where I want to extract slot values from a conversation using API. I tried with /conversations/<sender_id>/tracker but it gives all slot values as null.

When I write a custom action and pass on slot values to my server using tracker.current_slot_values(), i am able to get right slot values.

Is there a way I can accomplish this?

1 Like

Hello @ankur1708, welcome to the community!!

What port, etc are you sending to? This works ok for me out of the box with a basic setup and hitting the Rasa server API endpoint:

http://localhost:5005/conversations/3b2e8ce1fea6418e889c948843ab4e37/tracker where the 3b2 value is my sender_id/convo

That gives me back the expected response data ok:

{
    "sender_id": "3b2e8ce1fea6418e889c948843ab4e37",
    "slots": {},
    "latest_message": {
        "intent": {
            "name": "greet",
            "confidence": 0.9949953556
        },
        "entities": [],
        "intent_ranking": [
            {
                "name": "greet",
                "confidence": 0.9949953556
            },
            {
                "name": "deny",
                "confidence": 0.0023455254
            },
            {
                "name": "mood_great",
                "confidence": 0.0011070062
            },
            {
                "name": "goodbye",
                "confidence": 0.0010444863
            },
            {
                "name": "mood_unhappy",
                "confidence": 0.000322167
            },
            {
                "name": "affirm",
                "confidence": 0.0001594102
            },
            {
                "name": "bot_challenge",
                "confidence": 0.0000260771
            }
        ],
        "text": "hello"
    },
    "latest_event_time": 1573742364.8570969105,
    "followup_action": null,
    "paused": false,
    "events": [
        {
            "event": "action",
            "timestamp": 1573742361.406701088,
            "name": "action_listen",
            "policy": null,
            "confidence": null
        },
        {
            "event": "user",
            "timestamp": 1573742364.6719269753,
            "text": "hello",
            "parse_data": {
                "intent": {
                    "name": "greet",
                    "confidence": 0.9949953556
                },
                "entities": [],
                "intent_ranking": [
                    {
                        "name": "greet",
                        "confidence": 0.9949953556
                    },
                    {
                        "name": "deny",
                        "confidence": 0.0023455254
                    },
                    {
                        "name": "mood_great",
                        "confidence": 0.0011070062
                    },
                    {
                        "name": "goodbye",
                        "confidence": 0.0010444863
                    },
                    {
                        "name": "mood_unhappy",
                        "confidence": 0.000322167
                    },
                    {
                        "name": "affirm",
                        "confidence": 0.0001594102
                    },
                    {
                        "name": "bot_challenge",
                        "confidence": 0.0000260771
                    }
                ],
                "text": "hello"
            },
            "input_channel": "rasa",
            "message_id": "7e6078bfb5084a3cada3e6f690327eb2",
            "metadata": null
        },
        {
            "event": "action",
            "timestamp": 1573742364.8534100056,
            "name": "utter_greet",
            "policy": "policy_0_MemoizationPolicy",
            "confidence": 1.0
        },
        {
            "event": "bot",
            "timestamp": 1573742364.8534150124,
            "text": "Hey! How are you?",
            "data": {
                "elements": null,
                "quick_replies": null,
                "buttons": null,
                "attachment": null,
                "image": null,
                "custom": null
            },
            "metadata": {}
        },
        {
            "event": "action",
            "timestamp": 1573742364.8570969105,
            "name": "action_listen",
            "policy": "policy_0_MemoizationPolicy",
            "confidence": 1.0
        }
    ],
    "latest_input_channel": "rasa",
    "active_form": {},
    "latest_action_name": "action_listen"
}

Are you using the in-memory tracker or do you have a external one setup out of curiosity?

Thanks @btotharye.

I am using rasa’s default tracker and I am able to get the information about intents etc, but not slots :frowning:

I am using a form and setting the value of slot using user input. The slot value is getting set properly (I’ve verified that by using utterance with {slot_name}), but I am not able to get that value in API.

Or, is there an API where I can get current slot values in a conversation?

ah ok let me test with my form bot and see what I get

Hi, try using Tracker.current_slot_values(). Before that add: from rasa_sdk import Tracker.

What is the exact code to send this request and receive that json response?