This example provides sample code for integrating Tone Analyzer and Conversation.
-
ToneDetection.java - sample code to initialize a user object in the conversation payload's context (initUser), to call Tone Analyzer to retrieve tone for a user's input (invokeToneAsync), and to update tone in the user object in the conversation payload's context (updateUserTone).
-
ToneConversationIntegrationV1.java - sample code to use ToneDetection.java to add tone to the payload and send a request to the Conversation Service's message endpoint in an asynchronous manner.
Requirements to run the sample code
Credentials & the Workspace ID can be set in a properties, tone_conversation_integration.properties, or directly in the code.
Dependencies provided in
build.gradle
To run the code, use the provided gradle build file and wrapper configuration.
On Mac or Linux:
./gradlew run