-
Notifications
You must be signed in to change notification settings - Fork 22
Xatkit DSL constructs
Xatkit embeds an internal Java DSL to ease bot definition. This article presents the key parts of this DSL and how they can be combined. The implementation of the DSL is located in com.xatkit.dsl
(in xatkit-runtime), and the main class of the language is com.xatkit.dsl.DSL
. See also our examples and the Getting Started guide for more info on how to use them.
We call top-level methods the static methods that are typically used to start the definition of a bot fragment (intent, state, entities, transition condition, etc).
-
intent(String name)
: creates a partial intent with the provided name. The returned object provides method to specify training sentences, followed by optional context definitions. -
mapping(String name)
: creates a mapping entity with the given name. The returned object allows to configure the values of the mapping as well as their synonyms. -
composite(String name)
: creates a composite entity with the given name. The returned object allows to configure the entries of the entity.
📚 The object returned by
mapping
andcomposite
can also be used to specify the type of an intent parameter.
-
event(String name)
: similar tointent
, this method creates a partial event with the provided name. Events are typically not built by bot designers, but rather by platform developers who want to expose platform events to the designer. -
state(String name)
: creates a partial state with the provided name. The returned object provides methods to specify the state's body, its transitions, and its fallback. -
fallbackState()
: creates a partial fallback state (the state that is executed when a received event doesn't match any transition's condition of the current state). The returned object allows to specify the state's body, but doesn't allow to specify transitions (fallback states cannot have transitions). -
library()
: creates a library to group user intents and entities. -
model()
: creates a partial bot model. The returned object allows to specify the used intents and states, as well as the platforms to deploy the bot on and the providers to listen to. - Data type methods (e.g.
any()
,city()
): return an entity representing the data type. This entity can be used to specify the type of a context parameter.
-
IntentIs(IntentDefinition intent)
: returns a Predicate that can be used as a transition condition and evaluates a received intent against the provided one. -
EventIs(EventDefinition event)
: returns a Predicate that can be used as a transition condition and evaluates a received event against the provided one.
⚠ Complex transition conditions (using Predicate.or(...) or Predicate.and(...)) involving event/intent comparisons need to start with
IntentIs
orEventIs
otherwise the bot won't be properly deployed.
- Getting Started
- Configuring your bot
- Integrating an Intent Recognition Provider
- Adding a bot to your website
- Deploying on Slack
- Basic concepts
- Intents and Entities
- States, Transitions, and Context
- Default and Local Fallbacks
- Core Library