mindmeld.app module

This module contains the app component.

class mindmeld.app.Application(import_name, request_class=None, responder_class=None, text_preparation_pipeline=None, async_mode=False)[source]

Bases: object

The conversational application.

import_name

str -- The name of the application package.

app_path

str -- The application path.

app_manager

ApplicationManager -- The application manager.

request_class

Request -- Any class that inherits from Request.

responder_class

DialogueResponder -- Any class that inherits from the DialogueResponder.

text_preparation_pipeline

TextPreparationPipeline -- The application text preparation pipeline, if any.

async_mode

bool -- True if the application is async, False otherwise.

add_dialogue_rule(name, handler, **kwargs)[source]

Adds a dialogue rule for the dialogue manager.

Parameters:
  • name (str) -- The name of the dialogue state
  • handler (callable) -- The dialogue state handler function
  • kwargs (dict) -- A list of options which specify the dialogue rule
add_middleware(middleware)[source]

Adds middleware for the dialogue manager

Parameters:middleware (callable) -- A dialogue manager middleware function
auto_fill(name=None, *, form, **kwargs)[source]

Creates a flow to fill missing entities

cli()[source]

Initialize the application's command line interface.

custom_action(action=None, actions=None, async_mode=False, merge=True, config=None, **kwargs)[source]

Adds a custom action sequence handler for the dialogue manager.

Whenever the user hits this state, we invoke the sequence of custom action(s) and returns
the appropriate responder.
Parameters:
  • action (str) -- The name of a custom action.
  • actions (list) -- A list of names of custom actions.
  • async_mode (bool) -- Whether we should invoke this custom action asynchronously.
  • merge (bool) -- Whether we should merge the Responder with fields from the response, otherwise we will overwrite the fields (frame, directives) accordingly.
  • config (dict) -- The custom action config, if different from the application's.
dialogue_flow(**kwargs)[source]

Creates a dialogue flow for the application

handle(**kwargs)[source]

A decorator that is used to register dialogue state rules

lazy_init(nlp=None)[source]

Initialize the application manager, spin up the server and compile the dialogue rules.

middleware(*args)[source]

A decorator that is used to register dialogue handler middleware

register_func(name=None)[source]

Registers custom functions for mindmeld app

run(**kwargs)[source]

Runs the application on a local development server.

question_answerer

The application's Question Answerer, which is initialized as part of the application manager.