Dear Rasa Team,
I am currently trying to integrate Rasa into my python code (python 3.7, Ubuntu 18.04, Rasa 1.10.12) and here is a demo snippet of my code:
from rasa.core.policies.memoization import MemoizationPolicy
from rasa.core.policies.form_policy import FormPolicy
from rasa.core.policies.fallback import FallbackPolicy
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.utils.endpoints import EndpointConfig
memoization = MemoizationPolicy(
max_history = 5
)
form_policy = FormPolicy()
fallback = FallbackPolicy(
fallback_action_name = "utter_default",
core_threshold = 0.1,
nlu_threshold = 0.1,
ambiguity_threshold = 0.1
)
ted_policy = TEDPolicy(
max_history = 5,
epochs = 100
)
interpreter = RasaNLUInterpreter("models/20200901-123145/nlu")
domain="models/20200901-123145/core/domain.yml"
action_endpoint = EndpointConfig(url="http://localhost:5055/webhook")
agent = Agent(domain=domain, policies=[memoization, form_policy, fallback, ted_policy])
agent.load(model_path="models/20200901-123145", action_endpoint=action_endpoint) #, interpreter=interpreter)
# -------------------------------------------------------------------------------------------------
## Start the text-to-intent extraction
def parse_to_rasa(text):
print("Received text: " + text)
rasa_response = asyncio.run(agent.handle_text(text_message=text))
rasa_response = rasa_response[0]
rasa_response = str(rasa_response['text'])
print(rasa_response)
if __name__ == '__main__':
parse_to_rasa("Speichere 4 Liter Fanta")
The output is:
python3.7 rasa_code_integration_tester.py
2020-10-13 17:21:41.449871: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory
2020-10-13 17:21:41.449960: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory
2020-10-13 17:21:41.449978: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
2020-10-13 17:21:41.972795: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-10-13 17:21:41.972816: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-10-13 17:21:42.474931: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2020-10-13 17:21:42.474952: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
2020-10-13 17:21:42.474965: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (ilia-ThinkPad-T480s): /proc/driver/nvidia/version does not exist
2020-10-13 17:21:42.475095: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-10-13 17:21:42.498087: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 1999965000 Hz
2020-10-13 17:21:42.498463: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x5b9ed50 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-10-13 17:21:42.498487: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
WARNING:tensorflow:From /home/ilia/Claire_code/E66-Terminal/src/text-to-intent/.rasa-venv/lib/python3.7/site-packages/tensorflow_core/python/ops/array_grad.py:563: _EagerTensorBase.cpu (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.identity instead.
2020-10-13 17:21:43.205027: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
2020-10-13 17:21:47.153158: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
2020-10-13 17:21:47.949516: W tensorflow/core/kernels/data/generator_dataset_op.cc:103] Error occurred when finalizing GeneratorDataset iterator: Cancelled: Operation was cancelled
Received text: Speichere 4 Liter Heparin
/home/ilia/Claire_code/E66-Terminal/src/text-to-intent/.rasa-venv/lib/python3.7/site-packages/rasa/utils/common.py:363: UserWarning: Interpreter parsed an intent 'Speichere 4 Liter Heparin' which is not defined in the domain. Please make sure all intents are listed in the domain.
More info at https://rasa.com/docs/rasa/core/domains/
Tut mir leid, ich habe es leider nicht verstanden.
I have Rasa custom actions server running in the background (rasa run actions) and Rasa duckling server (sudo docker run -p 8000:8000 rasa/duckling). My Rasa chatbot works well if I run it from the terminal with “rasa shell”.
What am I missing? What am I doing wrong?
Many thanks in advance.
Best regards, Ilia
P.S. As you can probably see, I have set the configuration policy for the core, but I don’t know where to set the pipeline properties inside my code. When using Rasa shell bot, I have set both the pipeline properties and the core policies in the config.yml file.