public final class RasaDialoguePolicy extends Object implements DialoguePolicy
RasaOpenSourceNLU component and dispatches events
based on its contents.
A text response is dispatched as a PROMPT event, and an image
is dispatched as an ACTION event with an appAction of "displayImage" and a systemPrompt containing the image URL.
Intents that do not match the one produced by RasaOpenSourceNLU are
not supported and will result in ERROR events.
| Constructor and Description |
|---|
RasaDialoguePolicy(SpeechConfig speechConfig)
Create a new dialogue policy for handling responses from Rasa Open
Source.
|
| Modifier and Type | Method and Description |
|---|---|
void |
completeTurn(boolean success,
ConversationData conversationData,
DialogueDispatcher eventDispatcher)
Complete the pending user turn.
|
String |
dump(ConversationData conversationData)
Store the internal state of the dialogue policy in the specified data
store for cross-session persistence.
|
void |
handleTurn(NLUResult userTurn,
ConversationData conversationData,
DialogueDispatcher eventDispatcher)
Process a user turn and return a relevant response.
|
void |
load(String state,
ConversationData conversationData)
Load previously serialized internal state.
|
public RasaDialoguePolicy(SpeechConfig speechConfig)
speechConfig - configuration properties for this policy.public String dump(ConversationData conversationData)
DialoguePolicydump in interface DialoguePolicyconversationData - The data store where policy state should be
saved.public void load(String state, ConversationData conversationData)
DialoguePolicyload in interface DialoguePolicystate - Policy state serialized using dump().conversationData - The data store where any relevant policy state
should be loaded.public void handleTurn(NLUResult userTurn, ConversationData conversationData, DialogueDispatcher eventDispatcher)
DialoguePolicyhandleTurn in interface DialoguePolicyuserTurn - The user input as determined by the NLU
component.conversationData - Conversation data used to resolve and prepare a
response.eventDispatcher - Dispatcher used to notify listeners of dialogue
events.public void completeTurn(boolean success,
ConversationData conversationData,
DialogueDispatcher eventDispatcher)
DialoguePolicyThis method should be called after any actions or data retrieval pending in the app are completed.
completeTurn in interface DialoguePolicysuccess - true if the user's request/desired action
was fulfilled successfully; false
otherwise.conversationData - Conversation data used to resolve and prepare a
response.eventDispatcher - Dispatcher used to notify listeners of dialogueCopyright © 2021. All rights reserved.