Skip to content

Commit

Permalink
Separate feature configurations (#42)
Browse files Browse the repository at this point in the history
* Updated config to use Multistep and updated rasa-pro version.

* Added e2e test multistep folder with symlinks to relevant test.

* Added config folder with multistep config.

* Revert "Updated config to use Multistep and updated rasa-pro version."

This reverts commit 4a094ba.

* Updated rasa-pro to 3.9.3.

* Added seperate qdrant config and updated makefile.

* Updated the readme with the changes to config and new rasa version.

* Updated the poetry lock file.

* Correct typo.
  • Loading branch information
djcowley authored Jul 26, 2024
1 parent 2d8ea2d commit d089acb
Show file tree
Hide file tree
Showing 21 changed files with 162 additions and 55 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ rasa-run: .EXPORT_ALL_VARIABLES
rasa inspect --debug

rasa-train: .EXPORT_ALL_VARIABLES
rasa train -c config.yml -d domain --data data
rasa train -c config/config.yml -d domain --data data

rasa-train-multistep: .EXPORT_ALL_VARIABLES
rasa train -c config/multistep-config.yml -d domain --data data

rasa-train-qdrant: .EXPORT_ALL_VARIABLES
rasa train -c config/qdrant-config.yml -d domain --data data

rasa-actions:
rasa run actions
Expand All @@ -34,6 +40,9 @@ rasa-test-flaky: .EXPORT_ALL_VARIABLES
rasa-test-failing: .EXPORT_ALL_VARIABLES
rasa test e2e e2e_tests/failing

rasa-test-multistep: .EXPORT_ALL_VARIABLES
rasa test e2e e2e_tests/multistep

rasa-test-one: .EXPORT_ALL_VARIABLES
rasa test e2e $(target) --debug

Expand All @@ -54,7 +63,13 @@ run: .EXPORT_ALL_VARIABLES run-duckling
poetry run rasa inspect --debug

train: .EXPORT_ALL_VARIABLES
poetry run rasa train -c config.yml -d domain --data data
poetry run rasa train -c config/config.yml -d domain --data data

train-multistep: .EXPORT_ALL_VARIABLES
poetry run rasa train -c config/multistep-config.yml -d domain --data data

train-qdrant: .EXPORT_ALL_VARIABLES
poetry run rasa train -c config/qdrant-config.yml -d domain --data data

actions:
poetry run rasa run actions
Expand All @@ -68,6 +83,9 @@ test-flaky: .EXPORT_ALL_VARIABLES
test-failing: .EXPORT_ALL_VARIABLES
poetry run rasa test e2e e2e_tests/failing

test-multistep: .EXPORT_ALL_VARIABLES
poetry run rasa test e2e e2e_tests/multistep

test-one: .EXPORT_ALL_VARIABLES
poetry run rasa test e2e $(target) --debug

Expand Down
35 changes: 31 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This demo showcases a chatbot built with Rasa's LLM-native approach: [CALM](http
> CALM's current stage of development.
> [!NOTE]
> This demo bot is currently compatible with `3.9.1`.
> This demo bot is currently compatible with `3.9.3`.
## Terms of Use

Expand Down Expand Up @@ -280,7 +280,7 @@ After you cloned the repository, follow these installation steps:
RASA_DUCKLING_HTTP_URL=<url to the duckling server>
```

5. Set up the extractive search:
5. If using qdrant for extractive search:
- Setup a local docker instance of Qdrant
```
docker pull qdrant/qdrant
Expand Down Expand Up @@ -314,8 +314,11 @@ vector_store:
This configuration refers to `addons/qdrant.py` file and the class `Qdrant_Store`. This class is also an example that information retrievers can use a custom query, note that in `search()` function the query is rewritten using the chat transcript by `prepare_search_query` function.
### Configuration
Check `config.yml` to make sure the configuration is appropriate before you train and run the bot.
Check `config/config.yml` to make sure the configuration is appropriate before you train and run the bot.
There are some alternative configurations available in the config folder.
Theses can be used via the appropriate `make` command during training.
### Training the bot
Expand All @@ -325,9 +328,20 @@ make rasa-train
```
which is a shortcut for:
```commandline
rasa train -c config.yml -d domain --data data
rasa train -c config/config.yml -d domain --data data
```

Alternative configurations can be accessed for Multistep command generation:
```commandline
make rasa-train-multistep
```
or for Enterprise search with qdrant for extractive search:
```commandline
make rasa-train-qdrant
```



The trained model is stored in `models` directory located in the project root.

### Starting the assistant
Expand Down Expand Up @@ -418,3 +432,16 @@ or
```commandline
rasa test e2e e2e/tests/path/to/a/target/test.yml
```

------

To run only the tests which are relevant to multistep command generation,
you can use the make command:

```commandline
make rasa-test-multistep
```
or
```commandline
run rasa test e2e e2e_tests/multistep
```
44 changes: 44 additions & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
recipe: default.v1
language: en
pipeline:
- name: LLMBasedRouter
calm_entry:
sticky: "handles everything else, including finance and pizza orders"
nlu_entry:
sticky: "handles everything around health advice and hotel or restaurant bookings"
non_sticky: "handles chitchat"
- name: WhitespaceTokenizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: LogisticRegressionClassifier
max_iter: 100
solver: lbfgs
tol: 0.0001
random_state: 42
ranking_length: 10
- name: CRFEntityExtractor
- name: DucklingEntityExtractor
url: "http://localhost:8000"
dimensions: [ "time", "number" ]
timezone: "Europe/Berlin"
timeout: 3
- name: NLUCommandAdapter
- name: SingleStepLLMCommandGenerator
llm:
model_name: gpt-4
request_timeout: 7
temperature: 0.0
top_p: 0.0

policies:
- name: RulePolicy
- name: TEDPolicy
constrain_similarities: true
- name: FlowPolicy
- name: EnterpriseSearchPolicy
- name: IntentlessPolicy

assistant_id: 20240418-073244-narrow-archive
42 changes: 42 additions & 0 deletions config/multistep-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
recipe: default.v1
language: en
pipeline:
- name: LLMBasedRouter
calm_entry:
sticky: "handles everything else, including finance and pizza orders"
nlu_entry:
sticky: "handles everything around health advice and hotel or restaurant bookings"
non_sticky: "handles chitchat"
- name: WhitespaceTokenizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: char_wb
min_ngram: 1
max_ngram: 4
- name: LogisticRegressionClassifier
max_iter: 100
solver: lbfgs
tol: 0.0001
random_state: 42
ranking_length: 10
- name: CRFEntityExtractor
- name: DucklingEntityExtractor
url: "http://localhost:8000"
dimensions: [ "time", "number" ]
timezone: "Europe/Berlin"
timeout: 3
- name: NLUCommandAdapter
- name: MultiStepLLMCommandGenerator
llm:
model_name: gpt-3.5-turbo-0125
request_timeout: 7
temperature: 0.0
top_p: 0.0

policies:
- name: RulePolicy
- name: TEDPolicy
constrain_similarities: true
- name: FlowPolicy

assistant_id: 20240418-073244-narrow-archive
File renamed without changes.
1 change: 1 addition & 0 deletions e2e_tests/multistep/cancellations
1 change: 1 addition & 0 deletions e2e_tests/multistep/corrections
1 change: 1 addition & 0 deletions e2e_tests/multistep/disambiguation
1 change: 1 addition & 0 deletions e2e_tests/multistep/flow_guards
1 change: 1 addition & 0 deletions e2e_tests/multistep/happy_path
1 change: 1 addition & 0 deletions e2e_tests/multistep/intermittent_flow_switch.yml
1 change: 1 addition & 0 deletions e2e_tests/multistep/invalid_path
1 change: 1 addition & 0 deletions e2e_tests/multistep/invalid_user_inputs
1 change: 1 addition & 0 deletions e2e_tests/multistep/negations
1 change: 1 addition & 0 deletions e2e_tests/multistep/potential_bugs
1 change: 1 addition & 0 deletions e2e_tests/multistep/user_starts_multiple_flows.yml
1 change: 1 addition & 0 deletions e2e_tests/multistep/validation_too_little_money.yml
1 change: 0 additions & 1 deletion e2e_tests/passing/happy_path/user_fills_resetting_slot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ test_cases:
- slot_was_not_set:
- based_in_california
- utter: utter_can_do_something_else

Loading

0 comments on commit d089acb

Please sign in to comment.