Skip to content
This repository has been archived by the owner on Jul 30, 2021. It is now read-only.

Commit

Permalink
chore: migrate to Rasa 2.0.0.a1
Browse files Browse the repository at this point in the history
  • Loading branch information
NetBKarine committed Jul 20, 2020
1 parent 6d651d9 commit 29aea3d
Show file tree
Hide file tree
Showing 19 changed files with 510 additions and 1,041 deletions.
2 changes: 1 addition & 1 deletion action-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rasa/rasa:1.9.4 as base
FROM rasa/rasa:2.0.0a1 as base
EXPOSE 8080

COPY poetry.lock poetry.lock
Expand Down
43 changes: 0 additions & 43 deletions action-server/covidflow/actions/action_fallback.py

This file was deleted.

4 changes: 2 additions & 2 deletions action-server/covidflow/actions/action_unsupported_intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def run(
text,
parse_data={
"text": text,
"intent": {"name": "fallback", "confidence": 1.0},
"intent_ranking": [{"name": "fallback", "confidence": 1.0}],
"intent": {"name": "nlu_fallback", "confidence": 1.0},
"intent_ranking": [{"name": "nlu_fallback", "confidence": 1.0}],
"entities": [],
},
)
Expand Down
2 changes: 1 addition & 1 deletion action-server/covidflow/actions/question_answering_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ async def _activate_if_required(
intent = _get_intent(tracker)

# Fallback QA
if intent == "fallback":
if intent == "nlu_fallback":
question = tracker.latest_message.get("text", "")

result = await self.validate_active_question(
Expand Down
2 changes: 1 addition & 1 deletion action-server/covidflow/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Symptoms: # Not using an enum to avoid persisting enum values
NONE = "none"
NONE = "neni"
MILD = "mild"
MODERATE = "moderate"
SEVERE = "severe"
Expand Down
8 changes: 4 additions & 4 deletions action-server/tests/actions/test_question_answering_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def test_fallback_question_success(self, mock_protocol):
)

tracker = self.create_tracker(
active_form=False, intent="fallback", text=QUESTION
active_form=False, intent="nlu_fallback", text=QUESTION
)

self.run_form(tracker, DOMAIN)
Expand All @@ -377,7 +377,7 @@ def test_fallback_question_failure(self, mock_protocol):
)

tracker = self.create_tracker(
active_form=False, intent="fallback", text=QUESTION
active_form=False, intent="nlu_fallback", text=QUESTION
)

self.run_form(tracker, DOMAIN)
Expand Down Expand Up @@ -413,7 +413,7 @@ def test_fallback_question_out_of_distribution(self, mock_protocol):
)

tracker = self.create_tracker(
active_form=False, intent="fallback", text=QUESTION
active_form=False, intent="nlu_fallback", text=QUESTION
)

self.run_form(tracker, DOMAIN)
Expand Down Expand Up @@ -449,7 +449,7 @@ def test_fallback_question_need_assessment(self, mock_protocol):
)

tracker = self.create_tracker(
active_form=False, intent="fallback", text=QUESTION
active_form=False, intent="nlu_fallback", text=QUESTION
)

self.run_form(tracker, DOMAIN)
Expand Down
2 changes: 1 addition & 1 deletion core/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rasa/rasa:1.9.4-full
FROM rasa/rasa:2.0.0a1-full
EXPOSE 8080

COPY poetry.lock poetry.lock
Expand Down
4 changes: 2 additions & 2 deletions core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# include source code in any python subprocess
export PYTHONPATH = .

RASA_VERSION=1.9.4
RASA_VERSION=2.0.0a1

UID:=$(shell id -u)
GID:=$(shell id -g)
Expand Down Expand Up @@ -62,7 +62,7 @@ test:

train-en:
sh scripts/prepare-training-data.sh en
docker run \
docker run -it \
--rm -v ${PWD}:/app \
--user ${UID}:${GID} \
rasa/rasa:${RASA_VERSION}-full train \
Expand Down
10 changes: 2 additions & 8 deletions core/config/config.core.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
- name: FormPolicy
- name: RulePolicy
- name: AugmentedMemoizationPolicy
max_history: 10
- name: TEDPolicy
max_history: 10
epochs: 100
evaluate_on_number_of_examples: 0
random_seed: 42
- name: MappingPolicy
- name: "FallbackPolicy"
nlu_threshold: 0.3
ambiguity_threshold: 0.0
core_threshold: 0.0
fallback_action_name: "action_fallback"
- name: core.policies.unsupported_intent_policy.UnsupportedIntentPolicy
fallback_action_name: 'action_unsupported_intent'
fallback_action_name: "action_unsupported_intent"
4 changes: 4 additions & 0 deletions core/config/config.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ language: en
pipeline:
- name: ConveRTTokenizer
- name: ConveRTFeaturizer
case_sensitive: false
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
case_sensitive: false
- name: CountVectorsFeaturizer
case_sensitive: false
- name: CountVectorsFeaturizer
case_sensitive: false
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
Expand Down
4 changes: 3 additions & 1 deletion core/config/config.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ language: "fr" # your two-letter language code

pipeline:
- name: WhitespaceTokenizer
case_sensitive: false
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
case_sensitive: false
- name: CountVectorsFeaturizer
case_sensitive: false
- name: CountVectorsFeaturizer
case_sensitive: false
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
Expand Down
5 changes: 2 additions & 3 deletions core/core/policies/unsupported_intent_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"get_assessment",
"ask_question",
"navigate_test_locations",
"fallback",
"nlu_fallback",
]

AFFIRM_DENY_INTENTS = [
"deny",
"affirm",
]

FALLBACK_INTENT = "fallback"
FALLBACK_INTENT = "nlu_fallback"

SUPPORTED_INTENTS_BY_ACTION = {
"action_greeting_messages": [
Expand Down Expand Up @@ -61,7 +61,6 @@
"utter_ask_when_first_symptoms": AFFIRM_DENY_INTENTS,
}

FALLBACK_INTENT = "fallback"
GET_ASSESSMENT_INTENT = "get_assessment"
SELF_ASSESS_DONE_SLOT = "self_assess_done"

Expand Down
Loading

0 comments on commit 29aea3d

Please sign in to comment.