rasa 3.1
rasa version==3.6.15
python version==3.8.18
in nlu.yml I wrote regex limit to [0-9]{11}, \d{10, 11} and if I write less or more this limit it still gives me the values even if limit isn’t reached in actions.py
####################################
config.yml
recipe: default.v1
assistant_id: 20240103-180359-tiny-radian
language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: RegexEntityExtractor
- 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
policies: null
####################################
nlu.yml
- intent: credit_account
examples: |
- I want to check my [credit]{"entity": "account"} balance
- check my [credit card account]{"entity": "account"} balance
- check my [credit account]{"entity": "account"} balance
- Will you check my {"entity": "account"} balance?
- intent: my_account_number
examples: |
- my account number is [24185296310]{"entity": "account_number"}
- [14185296310]{"entity": "account_number"} is my account number
- here is my account number {"entity": "account_number"}
- regex: account_number
examples: |
- [0-9]{11}
- \d{10, 11}
- synonym: credit
examples: |
- credit card account
- credit account
########################################################
**domain.yml**
version: "3.1"
intents:
- credit_account
- my_account_number
entities:
- account
- account_number
actions:
- action_return_domain
session_config:
session_expiration_time: 60
carry_over_slots_to_new_session: true
#################################################
**stories.yml**
version: "3.1"
stories:
- story: get info about credit card
steps:
- intent: credit_account
entities:
- account: "credit"
- intent: my_account_number
entities:
- account_number: 24185296310
- action: action_return_domain
######################################
actions.py
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
class ActionReturnDomain(Action):
def name(self) -> Text:
return "action_return_domain"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
credit = next(tracker.get_latest_entity_values("account"), None)
account_number = next(tracker.get_latest_entity_values("account_number"), None)
print(f"credit", credit)
print(f"account number", account_number)