Interface BotDefinition
-
- All Implemented Interfaces:
-
ai.tock.translator.I18nKeyProvider
public interface BotDefinition implements I18nKeyProviderThe main interface used to define the behaviour of the bot.
New bots should usually not directly extend this class, but instead extend BotDefinitionBase.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classBotDefinition.Companion
-
Method Summary
Modifier and Type Method Description IntentfindIntent(String intent, String applicationId)Finds an Intent from an intent name. StoryDefinitionfindStoryDefinition(IntentAware intent, String applicationId)Finds a StoryDefinition from an Intent. StoryDefinitionfindStoryDefinition(String intent, String applicationId)Finds a StoryDefinition from an intent name. StoryDefinitionfindStoryDefinitionById(String storyId, String applicationId)Search story by storyId. StoryDefinitionfindStoryByStoryHandler(StoryHandler storyHandler, String applicationId)Search story by storyHandler. ActionerrorAction(PlayerId playerId, String applicationId, PlayerId recipientId)Called when error occurs. BooleandisableBot(UserTimeline timeline, Dialog dialog, Action action)Does this action trigger bot deactivation ? BooleanhasDisableTagIntent(Dialog dialog)Returns true if the dialog current intent is a disabling intent. BooleanenableBot(UserTimeline timeline, Dialog dialog, Action action)Does this action trigger bot activation ? BooleanhasToPersistAction(UserTimeline timeline, Action action)If this method returns true, the action will be added in the stored history. I18nLabelValuei18n(CharSequence defaultLabel, List<Object> args)Entityentity(String name, String role)Returns the entity with the specified name and optional role. I18nTranslatori18nTranslator(Locale userLocale, ConnectorType connectorType, UserInterfaceType userInterfaceType, String contextId)Returns an I18nTranslator for the specified userLocale and connectorType. LongdefaultDelay(Integer answerIndex)Get the default delay between two answers. abstract StringgetBotId()The main bot id. abstract StringgetNamespace()The namespace of the bot. abstract StringgetNlpModelName()The name of the main nlp model. abstract BotRAGConfigurationgetRagConfiguration()RAG configuration abstract UnitsetRagConfiguration(BotRAGConfiguration ragConfiguration)RAG configuration abstract BotVectorStoreConfigurationgetVectorStoreConfiguration()Vector Store configuration abstract UnitsetVectorStoreConfiguration(BotVectorStoreConfiguration vectorStoreConfiguration)Vector Store configuration abstract BotObservabilityConfigurationgetObservabilityConfiguration()Observability configuration abstract UnitsetObservabilityConfiguration(BotObservabilityConfiguration observabilityConfiguration)Observability configuration abstract List<StoryDefinition>getStories()The list of each story. abstract StoryDefinitiongetUnknownStory()The unknown story. abstract StoryDefinitiongetRagExcludedStory()The ragExcluded Story. abstract StoryDefinitiongetRagStory()The ragStory. abstract I18nLabelValuegetDefaultUnknownAnswer()The default unknown answer. abstract I18nLabelValuegetDefaultRagExcludedAnswer()The default rag excluded answer. abstract StoryDefinitiongetKeywordStory()To handle keywords - used to bypass nlp. abstract StoryDefinitiongetHelloStory()The hello story. StoryDefinitiongetDefaultStory()abstract StoryDefinitiongetGoodbyeStory()The goodbye story. abstract StoryDefinitiongetNoInputStory()The no input story. abstract StoryDefinitiongetUserLocationStory()The story that handles ai.tock.bot.engine.action.SendLocation action. abstract StoryDefinitiongetHandleAttachmentStory()The story that handles ai.tock.bot.engine.action.SendAttachment action. abstract EventListenergetEventListener()To handle custom events. abstract StoryDefinitiongetBotDisabledStory()To manage deactivation. List<StoryDefinition>getBotDisabledStories()abstract StoryDefinitiongetBotEnabledStory()To manage reactivation. List<StoryDefinition>getBotEnabledStories()Function1<Action, Unit>getBotEnabledListener()TestBehaviourgetTestBehaviour()DialogFlowDefinitiongetFlowDefinition()-
-
Method Detail
-
findIntent
Intent findIntent(String intent, String applicationId)
Finds an Intent from an intent name.
-
findStoryDefinition
StoryDefinition findStoryDefinition(IntentAware intent, String applicationId)
Finds a StoryDefinition from an Intent.
-
findStoryDefinition
StoryDefinition findStoryDefinition(String intent, String applicationId)
Finds a StoryDefinition from an intent name.
- Parameters:
intent- the intent nameapplicationId- the optional applicationId
-
findStoryDefinitionById
StoryDefinition findStoryDefinitionById(String storyId, String applicationId)
Search story by storyId.
-
findStoryByStoryHandler
StoryDefinition findStoryByStoryHandler(StoryHandler storyHandler, String applicationId)
Search story by storyHandler.
-
errorAction
Action errorAction(PlayerId playerId, String applicationId, PlayerId recipientId)
Called when error occurs. By default send "technical error".
-
disableBot
Boolean disableBot(UserTimeline timeline, Dialog dialog, Action action)
Does this action trigger bot deactivation ?
-
hasDisableTagIntent
Boolean hasDisableTagIntent(Dialog dialog)
Returns true if the dialog current intent is a disabling intent.
-
enableBot
Boolean enableBot(UserTimeline timeline, Dialog dialog, Action action)
Does this action trigger bot activation ?
-
hasToPersistAction
Boolean hasToPersistAction(UserTimeline timeline, Action action)
If this method returns true, the action will be added in the stored history.
By default, actions where the bot is not only ai.tock.bot.engine.dialog.EventState.notification are added in the bot history.
-
i18n
I18nLabelValue i18n(CharSequence defaultLabel, List<Object> args)
-
entity
Entity entity(String name, String role)
Returns the entity with the specified name and optional role.
-
i18nTranslator
I18nTranslator i18nTranslator(Locale userLocale, ConnectorType connectorType, UserInterfaceType userInterfaceType, String contextId)
Returns an I18nTranslator for the specified userLocale and connectorType.
-
defaultDelay
Long defaultDelay(Integer answerIndex)
Get the default delay between two answers.
-
getNamespace
abstract String getNamespace()
The namespace of the bot. It has to be the same namespace than the NLP models.
-
getNlpModelName
abstract String getNlpModelName()
The name of the main nlp model.
-
getRagConfiguration
abstract BotRAGConfiguration getRagConfiguration()
RAG configuration
-
setRagConfiguration
abstract Unit setRagConfiguration(BotRAGConfiguration ragConfiguration)
RAG configuration
-
getVectorStoreConfiguration
abstract BotVectorStoreConfiguration getVectorStoreConfiguration()
Vector Store configuration
-
setVectorStoreConfiguration
abstract Unit setVectorStoreConfiguration(BotVectorStoreConfiguration vectorStoreConfiguration)
Vector Store configuration
-
getObservabilityConfiguration
abstract BotObservabilityConfiguration getObservabilityConfiguration()
Observability configuration
-
setObservabilityConfiguration
abstract Unit setObservabilityConfiguration(BotObservabilityConfiguration observabilityConfiguration)
Observability configuration
-
getStories
abstract List<StoryDefinition> getStories()
The list of each story.
-
getUnknownStory
abstract StoryDefinition getUnknownStory()
The unknown story. Used where no valid intent is found.
-
getRagExcludedStory
abstract StoryDefinition getRagExcludedStory()
The ragExcluded Story. Used where ragexcluded intent is found.
-
getRagStory
abstract StoryDefinition getRagStory()
The ragStory. Used if RAG is enabled.
-
getDefaultUnknownAnswer
abstract I18nLabelValue getDefaultUnknownAnswer()
The default unknown answer.
-
getDefaultRagExcludedAnswer
abstract I18nLabelValue getDefaultRagExcludedAnswer()
The default rag excluded answer.
-
getKeywordStory
abstract StoryDefinition getKeywordStory()
To handle keywords - used to bypass nlp.
-
getHelloStory
abstract StoryDefinition getHelloStory()
The hello story. Used for first interaction with no other input.
-
getDefaultStory
StoryDefinition getDefaultStory()
-
getGoodbyeStory
abstract StoryDefinition getGoodbyeStory()
The goodbye story. Used when closing the conversation.
-
getNoInputStory
abstract StoryDefinition getNoInputStory()
The no input story. When user does nothing!
-
getUserLocationStory
abstract StoryDefinition getUserLocationStory()
The story that handles ai.tock.bot.engine.action.SendLocation action. If it's null, current intent is used.
-
getHandleAttachmentStory
abstract StoryDefinition getHandleAttachmentStory()
The story that handles ai.tock.bot.engine.action.SendAttachment action. If it's null, current intent is used.
-
getEventListener
abstract EventListener getEventListener()
To handle custom events.
-
getBotDisabledStory
abstract StoryDefinition getBotDisabledStory()
To manage deactivation.
-
getBotDisabledStories
List<StoryDefinition> getBotDisabledStories()
-
getBotEnabledStory
abstract StoryDefinition getBotEnabledStory()
To manage reactivation.
-
getBotEnabledStories
List<StoryDefinition> getBotEnabledStories()
-
getBotEnabledListener
Function1<Action, Unit> getBotEnabledListener()
-
getTestBehaviour
TestBehaviour getTestBehaviour()
-
getFlowDefinition
DialogFlowDefinition getFlowDefinition()
-
-
-
-