Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENG-424: initial port of moodbot to flows / command pattern #12683

Merged
merged 39 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
29df75c
naive port of moodbot to dm2
amn41 Jul 20, 2023
d4d2185
tweak prompt to avoid hallucination
amn41 Jul 20, 2023
12fba9c
domain for moodbot
amn41 Jul 20, 2023
c8eb924
new start here docs page
amn41 Jul 20, 2023
0f3be91
trigger build
amn41 Jul 20, 2023
3cc0513
updates to docs
amn41 Jul 20, 2023
f8c4f2c
Merge branch 'command-pattern' into command-moodbot
tmbo Jul 20, 2023
ae031d5
updated config
tmbo Jul 20, 2023
3227641
more work on tutorial
amn41 Jul 21, 2023
263b6fe
more work on docs
amn41 Jul 21, 2023
f720f29
fix
amn41 Jul 21, 2023
d881200
more edits on docs
amn41 Jul 21, 2023
e3d894c
docs
amn41 Jul 21, 2023
33994a9
docs
amn41 Jul 21, 2023
1ce611e
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
f93a40e
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
1dff43a
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
185f5b9
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
acf5525
put back playground and move dm2 getting started page to llms
amn41 Jul 25, 2023
061b340
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
b7b6a1d
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
0457ccd
Merge branch 'command-moodbot' of github.com:RasaHQ/rasa into command…
amn41 Jul 25, 2023
d525782
link to blog post
amn41 Jul 25, 2023
6341eaa
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
d1ce8ae
docs edits
amn41 Jul 25, 2023
ccbe381
Merge branch 'command-moodbot' of github.com:RasaHQ/rasa into command…
amn41 Jul 25, 2023
a2ac90d
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
3d8ad7e
initial project - dm2
amn41 Jul 25, 2023
bc5ec07
Merge branch 'command-moodbot' of github.com:RasaHQ/rasa into command…
amn41 Jul 25, 2023
88eaef1
restored original initial_proejct
amn41 Jul 25, 2023
d79fe99
Merge branch 'command-pattern' into command-moodbot
amn41 Jul 25, 2023
4a31014
remove flows file from initial project
amn41 Jul 25, 2023
eb8035e
mention dm2 flag in docs
amn41 Jul 25, 2023
19a1190
some docs updates
amn41 Jul 25, 2023
e4826e5
remove check for slotmapping type ENTITY for whether a slot is extrac…
amn41 Jul 25, 2023
3248dc7
Update docs/docs/start-here.mdx
amn41 Jul 25, 2023
aaf805a
Merge branch 'command-pattern' into command-moodbot
tmbo Jul 25, 2023
5908666
formatted
tmbo Jul 25, 2023
a34388a
fixed remaining issues
tmbo Jul 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/docs/start-here.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ controllability of intent-based approaches.

### Command Line Interface Basics

Once you have installed Rasa, you can run the `init` command to create a starter project:
Once you have instalgled Rasa, you can run the `init` command to create a starter project:
amn41 marked this conversation as resolved.
Show resolved Hide resolved

```bash
rasa init --dm2
Expand Down Expand Up @@ -62,7 +62,7 @@ for their preferred cuisine, city, and price range.
To try it out, start a conversation using `rasa shell`, and say something like "I'm looking for a restaurant".

Out of the box, this assistant can already handle a variety of conversations. The first is what we call the "happy path",
where the user provides all the important when it's requested.
where the user always provides the information the assistant requests.
But if users change their mind, answer indirectly, or interject with questions, this assistant can handle those cases as well.
Try out some of these conversations yourself to get a feel for things.
If you want your assistant to sound a bit more natural, you can activate [contextual rephrasing](./llms/llm-nlg.mdx) of responses.
Expand Down Expand Up @@ -184,8 +184,7 @@ The *conversation handling* approach requires much less work to set up, since yo
intents and entities and slot mappings. It is also more powerful because it allows us to
[break free from intents](https://rasa.com/blog/its-about-time-we-get-rid-of-intents/).

For example, if the user's response requires context to be understood correctly and is a challenge for
intent-based systems:
For example, intent-based approaches struggle when context is required to understand what the user means:

<Chat caption="pragmatic understanding">
<ChatBotText>Has it been more than 10 business days since you placed your order?</ChatBotText>
Expand Down
17 changes: 8 additions & 9 deletions rasa/cdu/command_generator/llm_command_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from rasa.shared.core.constants import (
MAPPING_TYPE,
SlotMappingType,
MAPPING_CONDITIONS,

Check failure on line 24 in rasa/cdu/command_generator/llm_command_generator.py

View workflow job for this annotation

GitHub Actions / Code Quality

F401 [*] `rasa.shared.core.constants.MAPPING_TYPE` imported but unused
ACTIVE_LOOP,

Check failure on line 25 in rasa/cdu/command_generator/llm_command_generator.py

View workflow job for this annotation

GitHub Actions / Code Quality

F401 [*] `rasa.shared.core.constants.SlotMappingType` imported but unused
)
from rasa.shared.core.flows.flow import FlowsList, QuestionFlowStep
from rasa.shared.core.trackers import DialogueStateTracker
Expand Down Expand Up @@ -246,15 +246,14 @@
return False

for mapping in slot.mappings:
if mapping.get(MAPPING_TYPE) == str(SlotMappingType.FROM_ENTITY):
conditions = mapping.get(MAPPING_CONDITIONS, [])
if len(conditions) == 0:
return True
else:
for condition in conditions:
active_loop = condition.get(ACTIVE_LOOP)
if active_loop and active_loop == tracker.active_loop_name:
return True
conditions = mapping.get(MAPPING_CONDITIONS, [])
if len(conditions) == 0:
return True
else:
for condition in conditions:
active_loop = condition.get(ACTIVE_LOOP)
if active_loop and active_loop == tracker.active_loop_name:
return True
return False

def render_template(
Expand Down
6 changes: 4 additions & 2 deletions rasa/cli/initial_project_dm2/data/flows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ flows:
next: "1"
- id: "1"
question: price_range
skip_if_filled: true
next: "2"
- id: "2"
question: part_of_town
question: city
skip_if_filled: true
next: "3"
- id: "3"
action: search_restaurants
action: utter_recommend_restaurant

11 changes: 6 additions & 5 deletions rasa/cli/initial_project_dm2/domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ slots:
type: text
mappings:
- type: custom
part_of_town:
city:
type: text
mappings:
- type: custom
Expand All @@ -32,8 +32,11 @@ responses:
utter_ask_price_range:
- text: "in what price range?"

utter_ask_part_of_town:
- text: "and in which part of town?"
utter_ask_city:
- text: "and in which city?"

utter_recommend_restaurant:
- text: "Here's a recommendation ..."

utter_cheer_up:
- text: "Here is something to cheer you up:"
Expand All @@ -55,8 +58,6 @@ responses:
utter_iamabot:
- text: "I am a bot, powered by Rasa."

actions:
- search_restaurants

session_config:
session_expiration_time: 60
Expand Down
5 changes: 5 additions & 0 deletions rasa/cli/initial_project_dm2/e2e_tests/complete_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test_cases:
- test_case: user corrects recipient in the next message
steps:
- user: I'm looking for a cheap Chinese restaurant in Amsterdam
- utter: utter_recommend_restaurant
11 changes: 11 additions & 0 deletions rasa/cli/initial_project_dm2/e2e_tests/happy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
test_cases:
- test_case: user corrects recipient in the next message
steps:
- user: Please recommend a restaurant
- utter: utter_ask_cuisine
- user: Indian food
- utter: utter_ask_price_range
- user: cheap
- utter: utter_ask_city
- user: Berlin
- utter: utter_recommend_restaurant
Loading