### Run Rasa Action Server with Rasa Installed Source: https://legacy-docs-oss.rasa.com/docs/rasa/action-server/running-action-server Use this command when Rasa is installed in your environment to start the action server. ```bash rasa run actions ``` -------------------------------- ### RabbitMQ Connection and Consumption Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/event-brokers Demonstrates how to establish a RabbitMQ connection using credentials and start consuming messages from a specified queue. This is useful for processing incoming events. ```python print("Received event {}".format(json.loads(body))) if __name__ == "__main__": # RabbitMQ credentials with username and password credentials = pika.PlainCredentials("username", "password") # Pika connection to the RabbitMQ host - typically 'rabbit' in a # docker environment, or 'localhost' in a local environment connection = pika.BlockingConnection( pika.ConnectionParameters("rabbit", credentials=credentials) ) # start consumption of channel channel = connection.channel() channel.basic_consume(queue="rasa_events", on_message_callback=_callback, auto_ack=True) channel.start_consuming() ``` -------------------------------- ### Basic Intent Training Examples Source: https://legacy-docs-oss.rasa.com/docs/rasa/training-data-format List basic training examples for an intent, with one example per line. ```yaml nlu: - intent: greet examples: | - hey - hi - whats up ``` -------------------------------- ### Install All Dependencies Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Install Rasa Open Source with all optional dependencies included. ```bash pip3 install 'rasa[full]' ``` -------------------------------- ### Install Rasa from Source Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Clone the Rasa repository and install it using Poetry for development versions. ```bash curl -sSL https://install.python-poetry.org | python3 - ``` ```bash git clone https://github.com/RasaHQ/rasa.git ``` ```bash cd rasa ``` ```bash poetry install ``` -------------------------------- ### Form Activation Intent Examples Source: https://legacy-docs-oss.rasa.com/docs/rasa/business-logic Add training examples for the intent that should activate the form. This snippet shows examples for the 'request_restaurant' intent. ```yaml nlu: - intent: request_restaurant examples: | - im looking for a restaurant - can i get [swedish](cuisine) food in any area - a restaurant that serves [caribbean](cuisine) food - id like a restaurant - im looking for a restaurant that serves [mediterranean](cuisine) food - can i find a restaurant that serves [chinese](cuisine) ``` -------------------------------- ### Example JSON Credentials File Source: https://legacy-docs-oss.rasa.com/docs/rasa/deploy/deploy-rasa-plus This is an example of the JSON credentials file you might receive for accessing a private registry. ```json { "type": "service_account", "project_id": "rasa-platform", "private_key_id": "somerandomcharacters", "private_key": "-----BEGIN PRIVATE KEY-----\n\nPBTu1lAJDLo136ZGTdMKi+/TuRqrIMg/..................................................................................................................................\nsjAsuAH4Iz1XdfdenzGnyBZH\n-----END PRIVATE KEY-----", "client_email": "company@rasa-platform.iam.gserviceaccount.com", "client_id": "12345678910123", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://accounts.google.com/o/oauth2/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/company%40rasa-platform.iam.gserviceaccount.com" } ``` -------------------------------- ### Check Docker and Docker Compose Installation Source: https://legacy-docs-oss.rasa.com/docs/rasa/docker/deploying-in-docker-compose Verify if Docker and Docker Compose are installed on your system by checking their versions. If the command fails, Docker needs to be installed. ```bash docker -v && docker-compose -v # Docker version 18.09.2, build 6247962 # docker-compose version 1.23.2, build 1110ad01 ``` -------------------------------- ### Check Docker Installation Source: https://legacy-docs-oss.rasa.com/docs/rasa/docker/building-in-docker Run this command to verify if Docker is installed on your system. The output will display the installed Docker version. ```bash docker -v ``` -------------------------------- ### Session Started Event Handling Source: https://legacy-docs-oss.rasa.com/docs/rasa/default-actions This snippet shows how to construct a list of events for the start of a session, including fetching slots and appending an action_listen event. ```python events = [SessionStarted()] events.extend(self.fetch_slots(tracker)) events.append(ActionExecuted("action_listen")) return events ``` -------------------------------- ### Install MITIE Dependencies Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Install the MITIE library and its dependencies for use with Rasa. ```bash pip3 install git+https://github.com/mit-nlp/MITIE.git ``` ```bash pip3 install 'rasa[mitie]' ``` -------------------------------- ### Install Rasa with Kafka support Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog To use the KafkaEventConsumer, install Rasa with the [kafka] extra dependency. ```bash $ pip install rasa[kafka] ``` -------------------------------- ### Install Pip Keyring Dependencies Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/rasa-pro/installation Installs necessary Python packages for Pip to authenticate with GCP Artifact Registry. Ensure keyring and its GCP backend are installed. ```bash pip install keyring pip install keyrings.google-artifactregistry-auth ``` -------------------------------- ### Sort Intent Examples Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/training_data/training_data Sort the intent examples first by intent name and then by response. ```python | sorted_intent_examples() -> List[Message] Sorts the intent examples by the name of the intent and then response ``` -------------------------------- ### Form Filling Intent Examples Source: https://legacy-docs-oss.rasa.com/docs/rasa/business-logic Add training examples for intents used when filling slots within a form. This snippet includes examples for 'affirm', 'deny', and 'inform' intents, with entity annotation for 'cuisine'. ```yaml nlu: - intent: affirm examples: | - Yes - yes, please - yup ``` ```yaml nlu: - intent: deny examples: | - no don't - no - no I don't want that ``` ```yaml nlu: - intent: inform examples: | - [afghan](cuisine) food - how bout [asian oriental](cuisine) - what about [indian](cuisine) food - uh how about [turkish](cuisine) type of food - um [english](cuisine) - im looking for [tuscan](cuisine) food - id like [moroccan](cuisine) food - for ten people - 2 people - for three people - just one person - book for seven people - 2 please - nine people ``` -------------------------------- ### Check Rust Installation (Linux) Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Verify the Rust compiler installation on Linux. ```bash rustc --version ``` -------------------------------- ### Example GET Request with If-None-Match Header Source: https://legacy-docs-oss.rasa.com/docs/rasa/model-storage This is an example of a GET request that Rasa Open Source sends to your model server. It includes the `If-None-Match` header with the model hash for caching purposes. ```bash curl --header "If-None-Match: d41d8cd98f00b204e9800998ecf8427e" http://my-server.com/models/default ``` -------------------------------- ### Install Rasa with spaCy Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Install Rasa Open Source along with spaCy and its English language model. ```bash pip3 install 'rasa[spacy]' ``` ```bash python3 -m spacy download en_core_web_md ``` -------------------------------- ### Example of Handling Text Input Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/agent Demonstrates how to load an agent and handle text input, showing the expected output format. ```python >>> from rasa.core.agent import Agent >>> agent = Agent.load("examples/moodbot/models") >>> await agent.handle_text("hello") [u'how can I help you?'] ``` -------------------------------- ### Duckling Entity Extractor Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components Example of entities extracted by the DucklingEntityExtractor, including start and end positions, entity type, value, confidence, and the extractor name. ```json { "entities": [{ "end": 53, "entity": "time", "start": 48, "value": "2017-04-10T00:00:00.000+02:00", "confidence": 1.0, "extractor": "DucklingEntityExtractor" }] } ``` -------------------------------- ### __init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/tracker_store Initializes the AwaitableTrackerStore by wrapping an existing TrackerStore. ```APIDOC ## __init__ ### Description Create a `AwaitableTrackerStore`. ### Arguments * `tracker_store` - the wrapped tracker store. ``` -------------------------------- ### __init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/domain_provider Creates a DomainProvider instance. ```APIDOC def __init__(model_storage: ModelStorage, resource: Resource, domain: Optional[Domain] = None) -> None ``` -------------------------------- ### MitieEntityExtractor Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components This is an example of the output format produced by the MitieEntityExtractor, showing extracted entities with their values, start and end positions, and the extractor name. Confidence scores are not provided. ```json { "entities": [{ "value": "New York City", "start": 20, "end": 33, "confidence": null, "entity": "city", "extractor": "MitieEntityExtractor" }] } ``` -------------------------------- ### Create a New Rasa Project Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Initialize a new Rasa project after installation. ```bash rasa init ``` -------------------------------- ### SpacyEntityExtractor Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components This is an example of the output format from the SpacyEntityExtractor, detailing extracted entities with their values, start and end indices, and the source extractor. Confidence scores are always null for this extractor. ```json { "entities": [{ "value": "New York City", "start": 20, "end": 33, "confidence": null, "entity": "city", "extractor": "SpacyEntityExtractor" }] } ``` -------------------------------- ### ProjectProvider Initialization Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/project_provider Initializes the ProjectProvider with a given configuration. ```python __init__(config: Dict[Text, Any]) -> None: Initializes the ProjectProvider. ``` -------------------------------- ### Story with a Conditional Checkpoint Source: https://legacy-docs-oss.rasa.com/docs/rasa/training-data-format This example demonstrates a story that starts with a checkpoint, which can be conditional on specific slots being set. ```yaml stories: - story: story_with_a_conditional_checkpoint steps: - checkpoint: greet_checkpoint ``` -------------------------------- ### JWT Authentication with Models Source: https://legacy-docs-oss.rasa.com/docs/rasa/http-api Example of starting the Rasa server with JWT authentication and specifying a models directory. ```bash rasa run \ -m models \ --enable-api \ --jwt-secret thisismysecret ``` -------------------------------- ### start_visualization Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/training/interactive Add routes to serve the conversation visualization files. ```APIDOC ## start_visualization ### Description Add routes to serve the conversation visualization files. ### Method def start_visualization(image_path: Text, port: int) -> None ``` -------------------------------- ### JWT Based Authentication Setup Source: https://legacy-docs-oss.rasa.com/docs/rasa/http-api Configure JWT-based authentication by specifying a JWT secret when starting the Rasa server. ```bash rasa run \ --enable-api \ --jwt-secret thisismysecret ``` -------------------------------- ### Customizing action_session_start Source: https://legacy-docs-oss.rasa.com/docs/rasa/default-actions Override the default session start action to control which slots are carried over to a new session. This example carries over only 'name' and 'phone_number'. ```python from typing import Any, Text, Dict, List from rasa_sdk import Action, Tracker from rasa_sdk.events import SlotSet, SessionStarted, ActionExecuted, EventType class ActionSessionStart(Action): def name(self) -> Text: return "action_session_start" @staticmethod def fetch_slots(tracker: Tracker) -> List[EventType]: """Collect slots that contain the user's name and phone number.""" slots = [] for key in ("name", "phone_number"): value = tracker.get_slot(key) if value is not None: slots.append(SlotSet(key=key, value=value)) return slots async def run( self, dispatcher, tracker: Tracker, domain: Dict[Text, Any], ) -> List[Dict[Text, Any]]: ``` -------------------------------- ### Simple Pipeline for Training Order Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/tuning-your-model A basic pipeline configuration used to illustrate the order of component calls during training. ```yaml pipeline: - name: "Component A" - name: "Component B" - name: "Last Component" ``` -------------------------------- ### Extract and Sort Entities Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/shared/nlu/training_data/training_data Extracts all entities from training examples and sorts them by entity type. Use this to get a structured overview of entities present in your data. ```python def sorted_entities() -> List[Any] ``` -------------------------------- ### Get Max Depth of OperatorMarker Tree Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/evaluation/marker_base Retrieves the maximum depth of the marker tree starting from this OperatorMarker. This can be useful for understanding the complexity of nested markers. ```python def max_depth() -> int ``` -------------------------------- ### TrainingTrackerProvider.__init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/training_tracker_provider Initializes the TrainingTrackerProvider with a configuration dictionary. ```APIDOC ## __init__ ### Description Creates provider from config. ### Method Signature def __init__(config: Dict[Text, Any]) -> None ``` -------------------------------- ### Marker Configuration Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/markers A comprehensive example of a marker configuration file for a mood bot. It demonstrates various operators and event conditions, including slot setting and negation. ```yaml marker_name_provided: description: "slot `name` was provided" slot_was_set: name marker_mood_expressed: or: - intent: mood_unhappy - intent: mood_great marker_cheer_up_failed: seq: - intent: mood_unhappy - action: utter_cheer_up - action: utter_did_that_help - intent: deny marker_bot_not_challenged: description: "Example of a negated marker, it can be used to surface conversations without bot_challenge intent" never: - intent: bot_challenge marker_cheer_up_attempted: at_least_once: - action: utter_cheer_up marker_mood_expressed_and_name_not_provided: and: - or: - intent: mood_unhappy - intent: mood_great - not: - slot_was_set: name ``` -------------------------------- ### Stories Connected by Checkpoints Source: https://legacy-docs-oss.rasa.com/docs/rasa/training-data-format This example shows two stories connected using a checkpoint. The first story ends with a checkpoint, and the second story starts with the same checkpoint. ```yaml stories: - story: story_with_a_checkpoint_1 steps: - intent: greet - action: utter_greet - checkpoint: greet_checkpoint - story: story_with_a_checkpoint_2 steps: - checkpoint: greet_checkpoint - intent: book_flight - action: action_book_flight ``` -------------------------------- ### Get Telemetry ID Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/telemetry Retrieves the unique telemetry identifier for the Rasa Open Source installation. The identifier should ideally be a UUID. Returns the ID if configured correctly. ```python def get_telemetry_id() -> Optional[Text] Return the unique telemetry identifier for this Rasa Open Source install. The identifier can be any string, but it should be a UUID. **Returns** : The identifier, if it is configured correctly. ``` -------------------------------- ### Get Tracker for Conversation Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/processor Retrieves the tracker for a specific conversation ID without adding session start events. Creates an empty tracker if the conversation is new. ```python async def get_tracker(conversation_id: Text) -> DialogueStateTracker ``` -------------------------------- ### Install Oracle Client and cx-Oracle Source: https://legacy-docs-oss.rasa.com/docs/rasa/tracker-stores This Dockerfile snippet shows how to install the Oracle Instant Client and the cx-Oracle Python library. It's used when you need to store conversation history in an Oracle database. ```dockerfile USER root RUN apt-get update -qq && apt-get install -y --no-install-recommends alien libaio1 && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Copy in oracle instaclient # https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html COPY oracle.rpm oracle.rpm # Install the Python wrapper library for the Oracle drivers RUN pip install cx-Oracle # Install Oracle client libraries RUN alien -i oracle.rpm USER 1001 ``` -------------------------------- ### Get Entity Tag IDs Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/utils/tensorflow/model_data_utils Generates a feature array containing the entity tag IDs for a given training example. This is crucial for sequence labeling tasks where entities need to be identified and tagged. ```python def get_tag_ids(example: Message, tag_spec: "EntityTagSpec", bilou_tagging: bool) -> "Features" Creates a feature array containing the entity tag ids of the given example. **Arguments** : * `example` - the message * `tag_spec` - entity tag spec * `bilou_tagging` - indicates whether BILOU tagging should be used or not **Returns** : A list of features. ``` -------------------------------- ### __init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/featurizers/dense_featurizer/mitie_featurizer Initializes a new instance of the MitieFeaturizer class. ```APIDOC ## __init__(config: Dict[Text, Any], execution_context: ExecutionContext) ### Parameters * `config` (Dict[Text, Any]) - The configuration dictionary for the component. * `execution_context` (ExecutionContext) - The execution context. ``` -------------------------------- ### Add Events to Conversation Tracker Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog The endpoint PUT /conversations//tracker/events no longer adds session start events automatically. To replicate previous behavior, send a GET /conversations//tracker request before appending events. ```http PUT /conversations//tracker/events ``` -------------------------------- ### Combine NLU, Stories, and Rules in One YAML File Source: https://legacy-docs-oss.rasa.com/docs/rasa/training-data-format This example shows how to include NLU examples, stories, and rules within a single YAML file for training data. Ensure the 'version' key is specified. ```yaml version: "3.1" nlu: - intent: greet examples: | - Hey - Hi - hey there [Sara](name) - intent: faq/language examples: | - What language do you speak? - Do you only handle english? stories: - story: greet and faq steps: - intent: greet - action: utter_greet - intent: faq - action: utter_faq rules: - rule: Greet user steps: - intent: greet - action: utter_greet ``` -------------------------------- ### Install Rust Compiler (macOS) Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Install Rustup and the Rust compiler on macOS to resolve potential installation issues. ```bash brew install rustup ``` ```bash rustup-init ``` -------------------------------- ### Install Rust Compiler (Linux) Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/installing-rasa-open-source Install Rust compiler and Cargo on Linux if you encounter issues with 'rasa[full]' installation. ```bash apt install rustc && apt install cargo ``` -------------------------------- ### Initialize AwaitableTrackerStore Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/tracker_store Instantiate `AwaitableTrackerStore` by wrapping an existing `TrackerStore` object. ```python def __init__(tracker_store: TrackerStore) -> None ``` -------------------------------- ### Initialize MitieNLP Component Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/utils/_mitie_utils Constructs a new language model from the MITIE framework. Use this to create an instance of the MitieNLP component. ```python class MitieNLP(Component) #### __init__# Copy | __init__(component_config: Optional[Dict[Text, Any]] = None, extractor: Optional["mitie.total_word_feature_extractor"] = None) -> None Construct a new language model from the MITIE framework. ``` -------------------------------- ### Intent Training Examples with Intent-Level Metadata Source: https://legacy-docs-oss.rasa.com/docs/rasa/training-data-format Apply metadata to all examples of an intent. This simplifies the data structure when the same metadata applies to all examples. ```yaml nlu: - intent: greet metadata: sentiment: neutral examples: - text: | hi - text: | hey there! ``` -------------------------------- ### Create KafkaProducer with Security Protocols Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog Example of creating a KafkaProducer, ensuring correct instantiation for PLAINTEXT and SASL_SSL security protocols. ```python from rasa.shared.core.kafka_utils import KafkaProducer KafkaProducer(security_protocol='PLAINTEXT') KafkaProducer(security_protocol='SASL_SSL') ``` -------------------------------- ### Example Marker Configuration Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog Demonstrates how to add descriptions to markers in Rasa configuration. This helps document the usage of each marker. ```yaml marker_name_provided: description: “Name slot has been set” slot_was_set: name marker_mood_expressed: description: “Unhappy or Great Mood was expressed” or: - intent: mood_unhappy - intent: mood_great ``` -------------------------------- ### MarkerTrackerLoader.__init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/evaluation/marker_tracker_loader Creates a MarkerTrackerLoader instance. ```APIDOC def __init__(tracker_store: TrackerStore, strategy: str, count: int = None, seed: Any = None) -> None Creates a MarkerTrackerLoader. Arguments: tracker_store - The underlying tracker store to access. strategy - The strategy to use for selecting trackers, can be 'all', 'sample_n', or 'first_n'. count - Number of trackers to return, can only be None if strategy is 'all'. seed - Optional seed to set up random number generator, only useful if strategy is 'sample_n'. ``` -------------------------------- ### Remove examples without a response Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/test Filters out examples that do not have a response assigned from a list of response selection evaluation results. This is useful for focusing on examples where a response was actually selected. ```python def remove_empty_response_examples( response_results: List[ResponseSelectionEvaluationResult] ) -> List[ResponseSelectionEvaluationResult] ``` -------------------------------- ### Load Marker Configurations from Directory Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/evaluation/markers Loads and appends multiple marker configurations from a directory tree. This allows for modular configuration management. ```python | @classmethod | from_directory(cls, path: Text) -> Dict Loads and appends multiple configs from a directory tree. ``` -------------------------------- ### Rasa JSON Training Data Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/shared/nlu/training_data/formats/rasa Example structure of Rasa NLU training data in JSON format, including regex features, entity synonyms, and common examples with intents. ```json { "rasa_nlu_data": { "regex_features": [ { "name": "zipcode", "pattern": "[0-9]{5}" } ], "entity_synonyms": [ { "value": "chinese", "synonyms": [ "Chinese", "Chines", "chines" ] } ], "common_examples": [ { "text": "hey", "intent": "greet", "regex_features": [] }, { "text": "howdy", "intent": "greet", "regex_features": [] } ] } } ``` -------------------------------- ### create Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/domain_for_core_training_provider Creates an instance of DomainForCoreTrainingProvider. ```APIDOC ## create @classmethod def create( cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext) -> DomainForCoreTrainingProvider Creates component (see parent class for full docstring). ``` -------------------------------- ### serve_application Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/run Runs the Rasa API entrypoint. ```APIDOC ## serve_application ### Description Run the API entrypoint for the Rasa server. ### Parameters - **model_path** (Optional[Text]) - Path to the Rasa model. - **channel** (Optional[Text]) - The input channel to use. - **interface** (Optional[Text]) - The server interface to use. Defaults to constants.DEFAULT_SERVER_INTERFACE. - **port** (int) - The port to run the server on. Defaults to constants.DEFAULT_SERVER_PORT. - **credentials** (Optional[Text]) - Path to the credentials file. - **cors** (Optional[Union[Text, List[Text]]]) - CORS configuration. - **auth_token** (Optional[Text]) - Authentication token. - **enable_api** (bool) - Whether to enable the Rasa API. Defaults to True. - **response_timeout** (int) - Timeout for responses. Defaults to constants.DEFAULT_RESPONSE_TIMEOUT. - **jwt_secret** (Optional[Text]) - JWT secret key. - **jwt_private_key** (Optional[Text]) - JWT private key. - **jwt_method** (Optional[Text]) - JWT authentication method. - **endpoints** (Optional[AvailableEndpoints]) - Available endpoints configuration. - **remote_storage** (Optional[Text]) - URL for remote model storage. - **log_file** (Optional[Text]) - Path to the log file. - **ssl_certificate** (Optional[Text]) - Path to the SSL certificate file. - **ssl_keyfile** (Optional[Text]) - Path to the SSL key file. - **ssl_ca_file** (Optional[Text]) - Path to the SSL CA certificate file. - **ssl_password** (Optional[Text]) - Password for the SSL key file. - **conversation_id** (Optional[Text]) - Default conversation ID. Defaults to a new UUID hex. - **use_syslog** (Optional[bool]) - Whether to use syslog. Defaults to False. - **syslog_address** (Optional[Text]) - Syslog server address. - **syslog_port** (Optional[int]) - Syslog server port. - **syslog_protocol** (Optional[Text]) - Syslog protocol. - **request_timeout** (Optional[int]) - Request timeout in seconds. - **server_listeners** (Optional[List[Tuple[Callable, Text]]]) - List of server listeners. ``` -------------------------------- ### CRFEntityExtractor Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components This is an example of the output format for entities extracted by the CRFEntityExtractor. ```json { "entities": [{ "value": "New York City", "start": 20, "end": 33, "entity": "city", "confidence": 0.874, "extractor": "CRFEntityExtractor" }] } ``` -------------------------------- ### Run Actions and End-to-End Tests Source: https://legacy-docs-oss.rasa.com/docs/rasa/testing-your-assistant Start the action server and then run end-to-end tests, necessary when test cases involve custom actions. ```bash rasa run actions && rasa test e2e ``` -------------------------------- ### config.yml with Suggested Config applied Source: https://legacy-docs-oss.rasa.com/docs/rasa/model-configuration This example shows a `config.yml` file after the 'Suggested Config' feature has been applied. Uncomment and modify the suggested pipeline components or policies as needed. If a key remains commented out and unspecified, Rasa will suggest a default configuration during training. ```yaml recipe: default.v1 assistant_id: example_bot 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 # - name: EntitySynonymMapper # - name: ResponseSelector # epochs: 100 # - name: FallbackClassifier # threshold: 0.3 # ambiguity_threshold: 0.1 policies: - name: MemoizationPolicy - name: TEDPolicy max_history: 5 epochs: 10 ``` -------------------------------- ### Dependency Incompatibility Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog Illustrates a common dependency conflict related to the 'multidict' package, highlighting version mismatches that can occur. ```text sanic 20.9.1 has requirement multidict==5.0.0, but you'll have multidict 4.6.0 which is incompatible. ``` -------------------------------- ### Install Python Development Packages on Ubuntu Source: https://legacy-docs-oss.rasa.com/docs/rasa/installation/environment-set-up Fetch and install the necessary Python development and pip packages using apt on Ubuntu systems. This is a prerequisite for setting up the Python environment. ```bash sudo apt update sudo apt install python3-dev python3-pip ``` -------------------------------- ### __init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/policies/ted_policy Initializes the TEDPolicy with the given configuration and resources. ```APIDOC ## __init__ def __init__(config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext, model: Optional[RasaModel] = None, featurizer: Optional[TrackerFeaturizer] = None, fake_features: Optional[Dict[Text, List[Features]]] = None, entity_tag_specs: Optional[List[EntityTagSpec]]) -> None Declares instance variables with default values. ``` -------------------------------- ### KeywordIntentClassifier Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components Example output from the KeywordIntentClassifier, showing the predicted intent and its confidence. ```json { "intent": {"name": "greet", "confidence": 1.0} } ``` -------------------------------- ### Provide Component Configuration Source: https://legacy-docs-oss.rasa.com/docs/rasa/graph-recipe Pass configuration parameters to the component. This example sets the language to 'en' and disables persistence. ```yaml config: language: en persist: false ``` -------------------------------- ### Parse Training Example for Entities and Synonyms Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/training_data/entities_parser Parses a training example to extract entities and synonyms, and converts the example into a plain text format. This function is a core part of processing NLU training data. ```python parse_training_example(example: Text, intent: Optional[Text] = None) -> "Message" ``` -------------------------------- ### Example Stories for `requested_slot` Source: https://legacy-docs-oss.rasa.com/docs/rasa/forms These stories demonstrate how to handle the `explain` intent differently based on the `requested_slot` when using forms. ```yaml stories: - story: explain cuisine slot steps: - intent: request_restaurant - action: restaurant_form - active_loop: restaurant - slot_was_set: - requested_slot: cuisine - intent: explain - action: utter_explain_cuisine - action: restaurant_form - active_loop: null - story: explain num_people slot steps: - intent: request_restaurant - action: restaurant_form - active_loop: restaurant - slot_was_set: - requested_slot: cuisine - slot_was_set: - requested_slot: num_people - intent: explain - action: utter_explain_num_people - action: restaurant_form - active_loop: null ``` -------------------------------- ### Incomplete Rule Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/policies An example of an incomplete rule where a slot is expected to be set but is missing in the steps. ```yaml rules: - rule: complete rule steps: - intent: search_venues - action: action_search_venues - slot_was_set: - venues: ["name": "Big Arena", "reviews": 4.5] - rule: incomplete rule steps: - intent: search_venues - action: action_search_venues ``` -------------------------------- ### SlackInput __init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/channels/slack Initializes the Slack input channel with necessary authentication and configuration settings. ```APIDOC ## __init__ ### Description Create a Slack input channel. Needs a couple of settings to properly authenticate and validate messages. ### Arguments * `slack_token` (Text) - Your Slack Authentication token. * `slack_channel` (Optional[Text]) - The string identifier for a channel to which the bot posts, or channel name. * `proxy` (Optional[Text]) - A Proxy Server to route your traffic through. * `slack_retry_reason_header` (Optional[Text]) - Slack HTTP header name indicating reason that slack send retry request. * `slack_retry_number_header` (Optional[Text]) - Slack HTTP header name indicating the attempt number. * `errors_ignore_retry` (Optional[List[Text]]) - Any error codes given by Slack included in this list will be ignored. * `use_threads` (Optional[bool]) - If set to `False`, your bot will send responses in Slack as a threaded message. Responses will appear as a normal Slack message if set to `True`. * `slack_signing_secret` (Text) - Slack creates a unique string for your app and shares it with you. This allows us to verify requests from Slack with confidence by verifying signatures using your signing secret. * `conversation_granularity` (Optional[Text]) - Conversation granularity for slack conversations. sender allows 1 conversation per user (across channels), channel allows 1 conversation per user per channel, thread allows 1 conversation per user per thread. ### Method def __init__(slack_token: Text, slack_channel: Optional[Text] = None, proxy: Optional[Text] = None, slack_retry_reason_header: Optional[Text] = None, slack_retry_number_header: Optional[Text] = None, errors_ignore_retry: Optional[List[Text]] = None, use_threads: Optional[bool] = False, slack_signing_secret: Text = "", conversation_granularity: Optional[Text] = "sender") -> None ``` -------------------------------- ### Start Conversation Visualization Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/training/interactive Serves conversation visualization files from a specified image path and port. This is used to view conversation flows graphically. ```python def start_visualization(image_path: Text, port: int) -> None ``` -------------------------------- ### Load Marker Configuration from Path Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/evaluation/markers Loads the marker configuration from a specified file or directory path. Ensures the configuration is correctly loaded for use. ```python | @classmethod | load_config_from_path(cls, path: Union[Text, Path]) -> Dict Loads the config from a file or directory. ``` -------------------------------- ### do_events_begin_with_session_start Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/shared/core/events Determines if a list of events starts with a session start sequence (action_session_start followed by session_started). ```APIDOC ## do_events_begin_with_session_start ### Description Determines whether `events` begins with a session start sequence. A session start sequence is a sequence of two events: an executed `action_session_start` as well as a logged `session_started`. ### Arguments * `events` - The events to inspect. ### Returns Whether `events` begins with a session start sequence. ### Signature ```python def do_events_begin_with_session_start(events: List["Event"]) -> bool ``` ``` -------------------------------- ### Count Examples Per Response Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/training_data/training_data Calculate and return a dictionary mapping each response to the number of training examples it has. ```python | @lazy_property | number_of_examples_per_response() -> Dict[Text, int] Calculates the number of examples per response. ``` -------------------------------- ### Initialize PrecomputedValueProvider Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/engine/training/components Initializes a `PrecomputedValueProvider` with a specified output. ```python def __init__(output: Cacheable) ``` -------------------------------- ### Initialize MitieNLP Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/utils/mitie_utils Constructs a new language model from the MITIE framework. Requires the path to the model file and an optional feature extractor. ```python def __init__( path_to_model_file: Path, extractor: Optional["mitie.total_word_feature_extractor"] = None ) -> None ``` -------------------------------- ### Count Examples Per Intent Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/training_data/training_data Calculate and return a dictionary mapping each intent to the number of training examples it has. ```python | @lazy_property | number_of_examples_per_intent() -> Dict[Text, int] Calculates the number of examples per intent. ``` -------------------------------- ### FallbackClassifier Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components An example of the output structure from the FallbackClassifier, including intent, intent ranking, and entities. ```json { "intent": {"name": "nlu_fallback", "confidence": 0.7183846840434321}, "intent_ranking": [ { "confidence": 0.7183846840434321, "name": "nlu_fallback" }, { "confidence": 0.28161531595656784, "name": "restaurant_search" } ], "entities": [{ "end": 53, "entity": "time", "start": 48, "value": "2017-04-10T00:00:00.000+02:00", "confidence": 1.0, "extractor": "DIETClassifier" }] } ``` -------------------------------- ### DIETClassifier Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components Example output from the DIETClassifier, including intent, intent ranking, and extracted entities. ```json { "intent": {"name": "greet", "confidence": 0.7800}, "intent_ranking": [ { "confidence": 0.7800, "name": "greet" }, { "confidence": 0.1400, "name": "goodbye" }, { "confidence": 0.0800, "name": "restaurant_search" } ], "entities": [{ "end": 53, "entity": "time", "start": 48, "value": "2017-04-10T00:00:00.000+02:00", "confidence": 1.0, "extractor": "DIETClassifier" }] } ``` -------------------------------- ### Fetch Tracker with Token Auth Source: https://legacy-docs-oss.rasa.com/docs/rasa/http-api Example of how to fetch a conversation tracker from the server using token-based authentication. ```bash curl -XGET localhost:5005/conversations/default/tracker?token=thisismysecret ``` -------------------------------- ### MitieIntentClassifier Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components Example of the output format for the MitieIntentClassifier, showing the predicted intent and its confidence score. ```json { "intent": {"name": "greet", "confidence": 0.98343} } ``` -------------------------------- ### GCSPersistor.__init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/persistor Initializes the GCSPersistor with a bucket name. ```APIDOC ## GCSPersistor.__init__ ### Description Initialise class with client and bucket. ### Signature ```python def __init__(bucket_name: Text) -> None ``` ``` -------------------------------- ### Contradicting Rules Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/policies An example illustrating two contradicting rules where the same intent leads to different actions. ```yaml rules: - rule: Chitchat steps: - intent: chitchat - action: utter_chitchat - rule: Greet instead of chitchat steps: - intent: chitchat - action: utter_greet # `utter_greet` contradicts `utter_chitchat` from the rule above ``` -------------------------------- ### RedisLockStore Initialization Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/lock_store Initializes a Redis lock store. Configure connection details like host, port, database, and authentication. SSL and key prefix options are also available. ```python def __init__( host: Text = "localhost", port: int = 6379, db: int = 1, username: Optional[Text] = None, password: Optional[Text] = None, use_ssl: bool = False, ssl_certfile: Optional[Text] = None, ssl_keyfile: Optional[Text] = None, ssl_ca_certs: Optional[Text] = None, key_prefix: Optional[Text] = None, socket_timeout: float = DEFAULT_SOCKET_TIMEOUT_IN_SECONDS) -> None ``` -------------------------------- ### Initialize BotFrameworkInput Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/channels/botframework Create a Bot Framework input channel. Requires your Bot Framework's API ID and application secret. ```python def __init__(app_id: Text, app_password: Text) -> None: """Create a Bot Framework input channel. **Arguments** : * `app_id` - Bot Framework's API id * `app_password` - Bot Framework application secret """ ``` -------------------------------- ### Redshift Example DB URL Source: https://legacy-docs-oss.rasa.com/docs/rasa/monitoring/analytics/getting-started-with-analytics An example of a Redshift DB URL format for the RASA_ANALYTICS_DB_URL environment variable. ```bash redshift://awsuser:4324312adfaGQ@analytics.cp1yucixmagz.us-east-1.redshift.amazonaws.com:5439/analytics ``` -------------------------------- ### MessageProcessor.__init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/processor Initializes a MessageProcessor. ```APIDOC def __init__( model_path: Union[Text, Path], tracker_store: rasa.core.tracker_store.TrackerStore, lock_store: LockStore, generator: NaturalLanguageGenerator, action_endpoint: Optional[EndpointConfig] = None, max_number_of_predictions: int = MAX_NUMBER_OF_PREDICTIONS, on_circuit_break: Optional[LambdaType] = None, http_interpreter: Optional[RasaNLUHttpInterpreter] = None) -> None Initializes a `MessageProcessor`. ``` -------------------------------- ### List Slot Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/domain Example of a list slot mapping from an entity. Used for storing lists of values. ```yaml slots: shopping_items: type: list mappings: - type: from_entity entity: shopping_item ``` -------------------------------- ### ProjectProvider get_default_config Method Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/project_provider Provides the default configuration for the ProjectProvider. ```python @staticmethod def get_default_config() -> Dict[Text, Any]: Default config for ProjectProvider. ``` -------------------------------- ### Text Slot Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/domain Example of a text slot mapping from an entity. Used for storing text values. ```yaml slots: cuisine: type: text mappings: - type: from_entity entity: cuisine ``` -------------------------------- ### Response Selector Output Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/components This example shows the structure of the output when a response selector is configured with a specific retrieval intent ('faq'). It includes the predicted response details and a ranking of other potential responses. ```json { "response_selector": { "faq": { "response": { "id": 1388783286124361986, "confidence": 0.7, "intent_response_key": "chitchat/ask_weather", "responses": [ { "text": "It's sunny in Berlin today", "image": "https://i.imgur.com/nGF1K8f.jpg" }, { "text": "I think it's about to rain." } ], "utter_action": "utter_chitchat/ask_weather" }, "ranking": [ { "id": 1388783286124361986, "confidence": 0.7, "intent_response_key": "chitchat/ask_weather" }, { "id": 1388783286124361986, "confidence": 0.3, "intent_response_key": "chitchat/ask_name" } ] } } } ``` -------------------------------- ### Start Rasa Shell Source: https://legacy-docs-oss.rasa.com/docs/rasa/command-line-interface Run this command to start a chat session with the latest trained Rasa model. ```bash rasa shell ``` -------------------------------- ### Initialize RasaNLUModelConfig Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/config Create a new instance of RasaNLUModelConfig. Optionally, provide a dictionary to override default configuration values. ```python __init__(configuration_values: Optional[Dict[Text, Any]] = None) -> None ``` -------------------------------- ### Rasa Story Format Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/changelog An example of a dialogue in the Rasa story format, demonstrating intents, entities, and actions. ```yaml stories: - story: collect restaurant booking info # name of the story - just for debugging steps: - intent: greet # user message with no entities - action: utter_ask_howcanhelp # action that the bot should execute - intent: inform # user message with entities entities: - location: "rome" - price: "cheap" - bot: On it # actual text that bot can output - action: utter_ask_cuisine - user: I would like [spanish](cuisine). # actual text that user input - action: utter_ask_num_people ``` -------------------------------- ### Run Rasa Server Source: https://legacy-docs-oss.rasa.com/docs/rasa/migrate-from/microsoft-luis-to-rasa Starts a server that listens on port 5005, making the trained NLU model available for requests. ```bash rasa run ``` -------------------------------- ### Verify Example Repetition in Intents Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/validator Checks for duplicated examples across different intents in the NLU training data. ```python def verify_example_repetition_in_intents(ignore_warnings: bool = True) -> bool Checks if there is no duplicated example in different intents. ``` -------------------------------- ### create Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/graph_components/providers/domain_provider Creates a DomainProvider component using a configuration dictionary and other necessary resources. ```APIDOC @classmethod def create(cls, config: Dict[Text, Any], model_storage: ModelStorage, resource: Resource, execution_context: ExecutionContext) -> DomainProvider ``` -------------------------------- ### RulePolicy Configuration Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/policies Example configuration for the RulePolicy in config.yml, including fallback settings and rule contradiction checks. ```yaml policies: - name: "RulePolicy" core_fallback_threshold: 0.3 core_fallback_action_name: action_default_fallback enable_fallback_prediction: true restrict_rules: true check_for_contradictions: true ``` -------------------------------- ### create Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/core/tracker_store A static method to create a tracker store, potentially wrapping it with AwaitableTrackerStore. ```APIDOC ## create ### Description Wrapper to call `create` method of primary tracker store. ### Arguments * `obj` - The tracker store object, endpoint configuration, or None. * `domain` - Optional domain object. * `event_broker` - Optional event broker object. ### Returns * `TrackerStore` - The created tracker store. ``` -------------------------------- ### Basic Story for UnexpecTEDIntentPolicy Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/policies A simple training story used to illustrate how negative examples are generated for the UnexpecTEDIntentPolicy. ```yaml version: 2.0 stories: - story: happy path 1 steps: - intent: greet - action: utter_greet - intent: mood_great - action: utter_goodbye ``` -------------------------------- ### Any Slot Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/domain Example of an 'any' slot type. Used for storing arbitrary values like dictionaries or lists. ```yaml slots: shopping_items: type: any mappings: - type: custom ``` -------------------------------- ### load Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/nlu/config Creates an NLU configuration object from a file path or a dictionary. If no configuration is provided, it loads from the default file path. ```APIDOC ## load ### Description Create configuration from file or dict. ### Arguments * `config` - a file path, a dictionary with configuration keys. If set to `None` the configuration will be loaded from the default file path. ### Returns Configuration object. ``` -------------------------------- ### DotProductLoss.__init__ Source: https://legacy-docs-oss.rasa.com/docs/rasa/reference/rasa/utils/tensorflow/layers Initializes the DotProductLoss layer with configuration parameters for similarity calculation and loss scaling. ```APIDOC ## __init__(num_candidates: int, scale_loss: bool = False, constrain_similarities: bool = True, model_confidence: Text = SOFTMAX, similarity_type: Text = INNER, name: Optional[Text] = None, **kwargs: Any) Declares instance variables with default values. **Arguments** : * `num_candidates` - Number of labels besides the positive one. Depending on whether single- or multi-label loss is implemented (done in sub-classes), these can be all negative example labels, or a mixture of negative and further positive labels, respectively. * `scale_loss` - Boolean, if `True` scale loss inverse proportionally to the confidence of the correct prediction. * `constrain_similarities` - Boolean, if `True` applies sigmoid on all similarity terms and adds to the loss function to ensure that similarity values are approximately bounded. Used inside _loss_cross_entropy() only. * `model_confidence` - Normalization of confidence values during inference. Currently, the only possible value is `SOFTMAX`. * `similarity_type` - Similarity measure to use, either `cosine` or `inner`. * `scale_loss`0 - Optional name of the layer. **Raises** : * `scale_loss`1 - When `similarity_type` is not one of `scale_loss`3 or `scale_loss`4. ``` -------------------------------- ### Boolean Slot Example Source: https://legacy-docs-oss.rasa.com/docs/rasa/domain Example of a boolean slot with a custom mapping. Used for storing true or false values. ```yaml slots: is_authenticated: type: bool mappings: - type: custom ```