Client integration is based on web socket provided by Core runner service.
Java/Android Client
If you want to create your own client in Java or Android platforms, you can use Promethist Common Client library for that. The whole source code of it is a part of Promethist Core project and can be found on GitHub.
We recommend using Java version 11 (OpenJDK).
First, add PromethistAI artifact repository to your project
First of all, every client has to implement BotClientCallback interface - following example demonstrates it (you can replace method implementations just printing what's has occurred with audio/visual processing logic of your client)
Then, you need to create BotContext object defining relation between client a conversational application
val context =BotContext("https://core.promethist.com", // Core service URL"5ea17702d28fd40eec1e9076", // application ID"device_ID", // CHANGE TO unique sender device identificationDynamic("clientType" to "client_type:1.0.0-SNAPSHOT"), // CHANGE TO your-client-name:version autoStart =false// set to true if you want to start application immediately as soon as client is open)
Bot Client
Client is represented by BotClient class which implements network communication with the Core service using web socket, processing input audio and playing output audio. To understand better networking part of implementation please take a look on web socket page too.
State
It is always in one of following states accessible via public property state
State
Description
Sleeping
No conversation is going on
Listening
Waiting for user input (if input audio device is available as described below, sending input audio to the server; otherwise waiting for text input by calling doText method)
Processing
User text input sent or text recognized in input audio on server side, waiting for response
Responding
Processing server response = display response text(s)/images and playing audio(s). As soon as the last audio play is finished it will go back to Listening state IF the response have not finished session (in that case client goes immediately to Sleeping state)
Open
Short time state between opening web socket and obtaining response to Init event.
Closed
Network connection is closed (after calling close method)
Failed
Network connection has failed. Client will keep trying to restore it every 20 seconds
Methods
Method
Description
open()
Open communication to the server. Call this method first and once before any other