Why is my Fallback Intent and FallbackClassifier not working in Rasa? - rasa-nlu

I have mentioned it in my pipeline in the config.yml file, that I will be using the FallbackClassifier.
So my code looks like:
language: en
pipeline:
- name: FallbackClassifier
threshold: 0.7
ambiguity_threshold: 0.1
However, I receive this error, when I try to run it:
InvalidConfigException: The pipeline configuration contains errors. The component 'FallbackClassifier' requires 'IntentClassifier' to be placed before it in the pipeline. Please add the required components to the pipeline.

the FallbackClassifier steps in when the IntentClassifier is not confident about the intent. so you cant use the Fallback classifier without using an Intentclassifier.
you can choose an IntentClassifier from this https://rasa.com/docs/rasa/components/#intent-classifiers
the most simple Intentclassifier is the "KeywordIntentClassifier" but it wont be a great choice if the bot is expected to make complicated Conversations.
this as an Example of a working Pipeline using the Fallbackclassifier:
language: "en"
pipeline:
- name: "WhitespaceTokenizer"
- name: "CountVectorsFeaturizer"
- name: "DIETClassifier"
- name: FallbackClassifier
threshold: 0.7
ambiguity_threshold: 0.1

Your FallbackClassifier needs a IntentClassifier, which further needs a Featurizer, and a Featurizer requires a Tokenizer.
So the easiest way of making your FallbackClassifier to work is to take the config.yml file from when you run rasa init on your CLI. Copy paste the config.yml code and remove all the "#" comment lines from the properties of "pipeline".
So your code for pipeline should look like this:
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 https://rasa.com/docs/rasa/tuning-your-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.7
ambiguity_threshold: 0.1
Now your FallbackClassifier should work like a charm!

Related

How to add Elastic APM integration from API/CMD/configuration file

I've created a docker-compose file with some configurations that deploy Elasticsearch, Kibana, Elastic Agent all version 8.7.0.
where in the Kibana configuration files I define the police I needed under xpack.fleet.agentPolicies, with single command all my environment goes up and all component connect successfully.
The only issue is there is one manual step, which is I had to go to Kibana -> Observability -> APM -> Add Elastic APM and then fill the Server configuration.
I want to automate this and manage this from the API/CMD/configuration file, I don't want to do it from the UI.
What is the way to do this? in which component? what is the path the configuration should be at?
I tried to look for APIs or command to do that, but with no luck. I'm expecting help with automating the remaning step.
#Update 1
I've tried to add it as below, but I still can't see the integration added.
package_policies:
- name: fleet_server-apm
id: default-fleet-server
package:
name: fleet_server
inputs:
- type: apm
enabled: true
vars:
- name: host
value: "0.0.0.0:8200"
- name: url
value: "http://0.0.0.0:8200"
- name: enable_rum
value: true
frozen: true
Tldr;
Yes, I believe there is a way to do it.
But I am pretty sure this is poorly documented.
You can find some idea in the repository of apm-server
Solution
In the kibana.yml file you can add some information related to fleet.
This section below is taken from the repository above and helped me set up apm automatically.
But if you have some specific settings you would like to see enable I am usure where you provide them.
xpack.fleet.packages:
- name: fleet_server
version: latest
xpack.fleet.agentPolicies:
- name: Fleet Server (APM)
id: fleet-server-apm
is_default_fleet_server: true
is_managed: false
namespace: default
package_policies:
- name: fleet_server-apm
id: default-fleet-server
package:
name: fleet_server
It is true that the kibana Fleet API is very poorly documented at this moment. I think your problem is that you are trying to add the variables to the fleet-server package insted of the apm package. Your yaml should look like this:
package_policies:
- name: fleet_server-apm
id: default-fleet-server
package:
name: fleet_server
- name: apm-1
package:
name: apm
inputs:
- type: apm
keep_enabled: true
vars:
- name: host
value: 0.0.0.0:8200
frozen: true
- name: url
value: "http://0.0.0.0:8200"
frozen: true
- name: enable_rum
value: true
frozen: true
Source

Continue Tekton pipeline after failure (similar to jenkins pipeline catchError behaviour)

I have a pipeline where I want to:
provision some resources,
run some tests,
tear down the resources.
I want the tear down task, in step 3, to run regardless of whether tests passed or failed, in step 2. As far as I’ve understoood runAfter only runs a task, if the previous task succeeded.
I tried looking into Conditions, but can’t seem to find an example…
Anything else I can use or some example someone could point me to ?
"finally" clause is implemented in Tekton Pipelines (Apr'20)
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pipeline-with-final-tasks
spec:
tasks:
- name: pre-work
taskRef:
Name: some-pre-work
- name: unit-test
taskRef:
Name: run-unit-test
runAfter:
- pre-work
- name: integration-test
taskRef:
Name: run-integration-test
runAfter:
- unit-test
finally:
- name: cleanup-test
taskRef:
Name: cleanup-cluster
- name: report-results
taskRef:
Name: report-test-results
Design document: Design doc: https://docs.google.com/document/d/1lxpYQHppiWOxsn4arqbwAFDo4T0-LCqpNa6p-TJdHrw/edit#
It turns out this is not yet supported in Tekton, at the time of writing.
It is, however, work-in-progress in the tektoncd/pipeline project, in this PR.

I am trying to change the policy in RASA from max_history: 5 to FullDialogueTrackerFeaturizer

I am new to using RASA and I was able to follow this guide:
https://rasa.com/docs/rasa/user-guide/installation/
to set up RASA on Ubunto 18.04 on windows. I am now following a second guide:
https://rasa.com/docs/rasa/user-guide/rasa-tutorial/
and am at step 3, running the code in step 3 on Ubuntu cane back with the following result:
# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline:
- name: WhitespaceTokenizer
- name: RegexFeaturizer
- name: LexicalSyntacticFeaturizer
- name: CountVectorsFeaturizer
- name: CountVectorsFeaturizer
analyzer: "char_wb"
min_ngram: 1
max_ngram: 4
- name: DIETClassifier
epochs: 100
- name: EntitySynonymMapper
- name: ResponseSelector
epochs: 100
# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
- name: MemoizationPolicy
- name: TEDPolicy
max_history: 5
epochs: 100
- name: MappingPolicy
Near the bottom, where it lists max_history: 5 I would like to change the policy to FullDialogueTrackerFeaturizer so that the entire dialog is considered for the bots production. I have tried reading this article:
https://rasa.com/docs/rasa/api/core-featurization/#featurization-conversations
although the article explains the function of the policy, I could not how to switch the policy.
My question is, how do I change the policy from max_history: 5 to FullDialogueTrackerFeaturizer?
FullDialogueTrackerFeaturizer is not a policy it's a featurizer. What you're describing is infinite max_history. This is not a good idea, as your model will become enormous and very slow. Instead, set max_history high enough to account for any patterns in your training data. If you need to save data for use at an arbitrary point in a conversation, set a slot instead.

Difference between PUT and OUTPUT steps in Concourse

Could someone tell me the difference between the PUT step and the OUTPUT step in Concourse? For example, in the following type of YAML files why do we need a put step after a get? Can't we use output instead of put? If not what are the purposes of each two?
jobs:
- name: PR-Test
plan:
- get: some-git-pull-request
trigger: true
- put: some-git-pull-request
params:
context: tests
path: some-git-pull-request
status: pending
....
<- some more code to build ->
....
The purpose of a PUT step is to push to the given resource while an OUTPUT is the result of TASK step.
A task can configure outputs to produce artifacts that can then be propagated to either a put step or to another task step in the same plan.
This means that you send the resource that you are specifying on the GET step to the task as an input, to perform wherever build or scripts executions and the output of that task
is a modified resource that you can later pass to your put step or to another TASK if you don't want to use PUT.
It would also depend on the nature of the defined resource in your pipeline. I'm assuming that you have a git type resource like this:
resources:
- name: some-git-pull-request
type: git
source:
branch: ((credentials.git.branch))
uri: ((credentials.git.uri))
username: ((credentials.git.username))
password: ((credentials.git.pass))
If this is true, the GET step will pull that repo so you can use it as an input for your tasks and if you use PUT against that same resource as you are describing in your sample code, that will push changes to your repo.
Really it depends on the workflow that you want to write but to give an idea it would look something like this:
jobs:
- name: PR-Test
plan:
- get: some-git-pull-request
trigger: true
- task: test-code
config:
platform: linux
image_resource:
type: docker-image
source:
repository: yourRepo/yourImage
tag: latest
inputs:
- name: some-git-pull-request
run:
path: bash
args:
- -exc
- |
cd theNameOfYourRepo
npm install -g mocha
npm test
outputs:
- name: some-git-pull-request-output
Then you can use it on either a PUT
- put: myCloud
params:
manifest: some-git-pull-request-output/manifest.yml
path: some-git-pull-request-output
or a another task whitin the same plan
- task: build-code
config:
platform: linux
image_resource:
type: docker-image
source:
repository: yourRepo/yourImage
tag: latest
inputs:
- name: some-git-pull-request-output
run:
path: bash
args:
- -exc
- |
cd some-git-pull-request-output/
npm install
gulp build
outputs:
- name: your-code-build-output
Hope it helps!

Concourse: Resource not found?

I am trying to built a concourse pipeline which is triggered by git, and then runs a script in that git repository.
This is what I have so far:
resources:
- name: component_structure_git
type: git
source:
branch: master
uri: git#bitbucket.org:foo/bar.git
jobs:
- name: component_structure-docker
serial: true
plan:
- aggregate:
- get: component_structure_git
trigger: true
- task: do-something
config:
platform: linux
image_resource:
type: docker-image
source: { repository: ubuntu }
inputs:
- name: component_structure_git
outputs:
- name: updated-gist
run:
path: component_structure_git/run.sh
- put: component_structure-docker
params:
build: component_structure/concourse
- name: component_structure-deploy-test
serial: true
plan:
- aggregate:
- get: component_structure-docker
passed: [component_structure-docker]
- name: component_structure-deploy-prod
serial: true
plan:
- aggregate:
- get: component_structure-docker
passed: [component_structure-docker]
When I apply this code with fly, everything is ok. When I try to run the build. it fails with the following error:
missing inputs: component_structure_git
Any idea what I am missing here?
Agree with first answer. When running things in parallel (aggregate blocks) there are a few things to consider
How many inputs do I have? I have more than one, let's run these get steps in an aggregate block
If I have two tasks, is there a dependency between the tasks that can change the outcome of a task run, eg. Do I have an output from one task that is required in the next task
I have a sequence of put statements, let's run these steps in an aggregate block
just a guess but aggregate is causing the issue. You can't have an input from something that is executing at the same time? Why do you have aggregate anyway? This is usually used for "get" to speed up the process.

Resources