How to collect data from button to slot?

@nik202 Can you share the email id please

@nik202 just forwarded all the files . Forgot to add action.py

from typing import Any, Text, Dict, List

from rasa_sdk import Action, Tracker from rasa_sdk.events import SlotSet from requests.auth import HTTPBasicAuth from requests.structures import CaseInsensitiveDict import json

import mariadb

import sys import requests from rasa_sdk.executor import CollectingDispatcher from rasa_sdk.forms import FormAction

class ActionHelloWorld(Action): def name(self) β†’ Text: return β€œaction_hello_world”

def run(self, dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    print("Entering the loop")
    button_resp = [
        {
            "title": "Worker Compensation",
            "payload": '/Worker{"claimtype":"Worker Compensation"}',

        },
        {
            "title": "General Liability",
            "payload": '/General{"claimtype":"General Liability"}',

        }
    ]
    dispatcher.utter_message(text="Please select below for reporting the claim",buttons=button_resp)
    # print("Button resposne is ",button_resp)
    claimtypes = tracker.get_slot('claimtype')
    print("Value of claim is ", claimtypes)
    return []

@nitish007 you even missed config.yml file… :stuck_out_tongue_winking_eye:.Please mail me back all the files and do check the mail. zip it and send me all it will be easy for me and I will send you back the same zip folder excluding models please :slight_smile:

@nik202

Configuration for Rasa NLU.

https://rasa.com/docs/rasa/nlu/components/

language: en

pipeline:

# No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.

# If you’d like to customize it, uncomment and adjust the pipeline.

# See Tuning Your NLU Model for more information.

- name: WhitespaceTokenizer

- name: RegexFeaturizer

- name: LexicalSyntacticFeaturizer

- name: CountVectorsFeaturizer

- name: CountVectorsFeaturizer

analyzer: char_wb

min_ngram: 1

max_ngram: 4

- name: DIETClassifier

epochs: 100

constrain_similarities: true

- name: EntitySynonymMapper

- name: ResponseSelector

epochs: 100

constrain_similarities: true

- name: FallbackClassifier

threshold: 0.3

ambiguity_threshold: 0.1

Configuration for Rasa Core.

https://rasa.com/docs/rasa/core/policies/

policies:

# No configuration for policies was provided. The following default policies were used to train your model.

# If you’d like to customize them, uncomment and adjust the policies.

# See Policies for more information.

- name: MemoizationPolicy

- name: TEDPolicy

max_history: 5

epochs: 100

constrain_similarities: true

- name: RulePolicy

# No configuration for policies was provided. The following default policies were used to train your model.

# If you’d like to customize them, uncomment and adjust the policies.

# See Policies for more information.

- name: MemoizationPolicy

- name: TEDPolicy

max_history: 5

epochs: 100

constrain_similarities: true

- name: RulePolicy

config file

1 Like

@nitish007 I have run your code and set the issue but just a button one as I committed:

This is what you want to set the slot as per button?

#please ignore the typo error Genera it is General :wink:
# even I will later fix the please select below for reporting the claim which print because you had mention in action.

It will also take the user input selection and save in claim.

Will send your updated file soon!!

1 Like

@darpant-289 you still have issue?

Thanks @nik202 for your efforts .Really helpful . Do let me know where i was wrong .

yes I will share my files here.

actions.py (7.1 KB) nlu_converted.yml (662 Bytes) stories_converted.yml (602 Bytes)

domain.yml (4.5 KB) config.yml (570 Bytes)

@darpant-289 What is your problem, now me confused with nitish007 problem. I hope you understand. Just briefly tell me. Thanks

sure

@darpant-289 Are you able to solve?

no please

@darpant-289 I asked you for your problem in brief and yet waiting.

So sorry . I have made manu of technologies and client can choose it . but it can’t save in db so that is problem . Other buttons works very well. I have shared my files in above chat.

hi @nik202 Tried what you suggested but why the values in slots are opposite of what we have selected .

@nitish007 In which context you are saying?