askbob.action package¶
Submodules¶
askbob.action.responder module¶
-
class
askbob.action.responder.
RasaResponseService
(model_dir: str = 'data/rasa/models', plugins_location='plugins', plugins_port=5055)¶ Bases:
askbob.action.responder.ResponseService
A ResponseService that uses Rasa running locally to respond to queries.
-
agent
: rasa.core.agent.Agent¶
-
handle
(query: str, sender: str = 'askbob')¶ Handles a queries and produces a response.
- Parameters
query (str) – The user’s query.
sender (str, optional) – A unique sender identifier. Defaults to “askbob”.
- Raises
NotImplementedError – This is just an interface - please use a concrete implementation!
-
is_ready
() → bool¶ Returns whether the response service is ready to accept queries.
- Returns
Whether or not the response server is ready to accept queries.
- Return type
bool
-
-
class
askbob.action.responder.
ResponseService
¶ Bases:
object
An interface for a response service, which produces responses for text queries.
-
async
handle
(query: str, sender: str = 'askbob')¶ Handles a queries and produces a response.
- Parameters
query (str) – The user’s query.
sender (str, optional) – A unique sender identifier. Defaults to “askbob”.
- Raises
NotImplementedError – This is just an interface - please use a concrete implementation!
-
is_ready
() → bool¶ Returns whether the response service is ready to accept queries.
- Returns
Whether or not the response server is ready to accept queries.
- Return type
bool
-
async
-
askbob.action.responder.
yielder
(m: Dict[str, Any]) → Dict[str, Any]¶ A helper function to generate correct message responses shared between ResponseService implementations.
- Parameters
m (Dict[Text, Any]) – The message returned by Rasa.
- Returns
An AskBob-formatted response.
- Return type
Dict[Text, Any]