CAILA NLU activator

Allows to use CAILA NLU engine as a states activator in JAICF with named entity recognition.

Basic template with Caila activator can be found here.

How to use

1. Include Caila dependency to your build.gradle

implementation("com.just-ai.jaicf:caila:$jaicfVersion")

Replace $jaicfVersion with the latest version

2. Use Caila activator in your scenario actions

state("launch") {
    activators {
        intent("Hello")
    }

    action {
        // Fills slots in intent
        val slots = activator.caila?.slots

        // Recognizes entities in query
        val entities = activator.caila?.entities

        // May contain answer 
        activator.caila?.topIntent?.answer?.let {
            reactions.say(it)
        }

        // contains top N inference variants 
        val variants = activator.caila?.result?.inference?.variants
        
        // contains phrase markup (tokenization, lemmatization)
        val markup = activator.caila?.result?.markup
    }
}

Learn more about CailaIntentActivatorContext.

3. Create project in JAICP Application Panel

All you need to use Caila is to create project in JAICP Application Panel. We have full guide, How to integrate with JAICP, but, in general, you have to:

  1. Register here,
  2. Create JAICF Project,
  3. Copy and paste token.

4. Configure Caila activator

val cailaActivator = CailaIntentActivator.Factory(
    CailaNLUSettings(
        accessToken = "<your_jaicp_access_token>", 
        confidenceThreshold = 0.2,
        // optional thresholds for patterns and phrases match. If it's not specified, confidenceThreshold will be used
        intentThresholds = IntentThresholds (
            patterns = 0.3,
            phrases = 0.3
        )
))

val helloWorldBot = BotEngine(
    scenario = HelloWorldScenario,
    activators = arrayOf(
        cailaActivator
    )
)