Conversational interface framework

nlp, conversational, conversational-interfaces, conversational-ui, emergent, neurons, oratio
npm install @oratio/oratio@0.0.10



Emergent natural language processing

Getting started

Create a new HiveMind with the HiveMindBuilder:

    const mind = HiveMindBuilder.createEmpty()

Give it user input:

    const response: Promise<IHiveResponse> = mind.process(input, "en", {})

Show any applicable output to the user in any desired way, the response has the following fields:

    // message key of the response, the application can translate to any language
    response: string,
    // possible parameters for the output / translation
    params: string[],
    // the certainty, if too low handle accordingly
    certainty: number,
    // a possible action the user wanted to perform, this is especially useful for application specific neurons
    action: () => void,
    // the scope to perform the action on, to allow using injected services in the action
    context: any

Adding custom neurons

Create a neuron which implements the following interface:

public process(words: string[], locale: string, context: RequestContext): Promise<INeuronResponse>

Add the neuron in the builder:

    const mind = HiveMindBuilder.createEmpty()
            .register([new YourNeuronHere()])

The array can obviously contain more neurons, as more custom neurons are created simply add them to the array.

Emergent system

There is no single major intelligence responsible for the system, instead every neuron processes every input and determines whether it can do anything with it. All neurons are collected in the hive, the hive makes sure all neurons receive user input until a response is found.


A neuron can easily be added to the hive, all it has to do is implement the following function:

public process(words: string[], locale: string, context: RequestContext): Promise<INeuronResponse>

then it has to be registered with the hive who manages all neurons.


The Hive processes all user input, it favors neurons who succesfully process user-input. The hive is constantly changing the order of the neurons to make sure the hive adjusts to what the user is currently doing.


The response always contains a response, which is a code that can be localized by other applications. The response can also include an action (function: () => void) which the neuron thought the user intended. The action ca be executed on a certain context, allowing the calling-party to use injected services in the action.