just-ai / aimybox-android-assistant

Embeddable custom voice assistant for Android applications
https://aimybox.com
Apache License 2.0
226 stars 52 forks source link
android android-app kotlin kotlin-android speech-recognition voice voice-assistant

Aimybox voice assistant

Open source voice assistant built on top of Aimybox SDK

Twitter Follow Travis CI Build Maven Central artifact ### iOS version is available [here](https://github.com/just-ai/aimybox-ios-assistant) #### Note that _components_ library was moved to [Aimybox Android SDK repository](https://github.com/just-ai/aimybox-android-sdk/tree/master/components). # Key Features * Provides ready to use **UI components** for fast building of your voice assistant app * Modular and independent from speech-to-text, text-to-speech and NLU vendors * Provides ready to use speech-to-text and text-to-speech implementations like [Android platform speechkit](https://github.com/just-ai/aimybox-android-sdk/tree/master/google-platform-speechkit), [Google Cloud speechkit](https://github.com/just-ai/aimybox-android-sdk/tree/master/google-cloud-speechkit), [Houndify](https://github.com/just-ai/aimybox-android-sdk/tree/master/houndify-speechkit) or [Snowboy wake word trigger](https://github.com/just-ai/aimybox-android-sdk/tree/master/snowboy-speechkit) * Works with any NLU providers like [Aimylogic](https://help.aimybox.com/en/article/aimylogic-webhook-5quhb1/), [Rasa](https://github.com/just-ai/aimybox-android-sdk/tree/master/rasa-api) or [Dialogflow](https://help.aimybox.com/en/article/dialogflow-agent-cqdvjn/) * Fully customizable and extendable, you can connect any other speech-to-text, text-to-speech and NLU services * Open source under Apache 2.0, written in pure Kotlin * Embeddable into any application or device running Android * Voice skills logic and complexity is not limited by any restrictions * Can interact with any local device services and local networks # How to start using Just clone this repository and try to build and run the app module 😉 If you want some details - there is how to do the same with your hands. 1. Create a new Android project with next dependencies in the _build.gradle_ file ```kotlin android { compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } } repositories { mavenCentral() } dependencies { implementation("com.just-ai.aimybox:core:$aimyboxVersion") implementation("com.just-ai.aimybox:components:$aimyboxVersion") } ``` _Use the latest version ![Maven Central](https://img.shields.io/maven-central/v/com.just-ai.aimybox/core?color=000000&label=%20&style=flat-square)_ 2. Add one or more dependencies of third party speech-to-text and text-to-speech libraries. For example ```kotlin implementation("com.just-ai.aimybox:google-platform-speechkit:$aimyboxVersion") ``` 3. Create a new project in [Aimybox console](https://help.aimybox.com/en/article/introduction-to-aimybox-web-console-n49kfr/), enable some voice skills and **copy your project's API key**. 4. Instantiate [Aimybox](https://github.com/just-ai/aimybox-android-sdk/blob/master/core/src/main/java/com/justai/aimybox/Aimybox.kt) in your [Application](https://github.com/just-ai/aimybox-android-assistant/blob/master/app/src/main/java/com/justai/aimybox/assistant/AimyboxApplication.kt) class like that ```kotlin class AimyboxApplication : Application(), AimyboxProvider { companion object { private const val AIMYBOX_API_KEY = "your Aimybox project key" } override val aimybox by lazy { createAimybox(this) } private fun createAimybox(context: Context): Aimybox { val unitId = UUID.randomUUID().toString() val textToSpeech = GooglePlatformTextToSpeech(context) val speechToText = GooglePlatformSpeechToText(context) val dialogApi = AimyboxDialogApi(AIMYBOX_API_KEY, unitId) val aimyboxConfig = Config.create(speechToText, textToSpeech, dialogApi) return Aimybox(aimyboxConfig) } } ``` 5. Add `FrameLayout` to your application's layout like this ```xml ``` 6. Add `AimyboxAssistantFragment` in your activity that uses this layout ( like [here](https://github.com/just-ai/aimybox-android-assistant/blob/master/app/src/main/java/com/justai/aimybox/assistant/MainActivity.kt)) ```kotlin override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.layout_activity_main) supportFragmentManager.beginTransaction().apply { replace(R.id.assistant_container, AimyboxAssistantFragment()) commit() } } ``` 7. Make sure your app's theme contains Aimybox's styles: ```xml ``` Now you can run your application and tap a small microphone button in bottom right corner of the screen. Try to say some phrase that corresponds to any of enabled voice skills in your Aimybox project. _Your assistant will handle all job regarding speech recognition, processing, displaying and synthesising of the response._ # More details Please refer to the [demo app](https://github.com/just-ai/aimybox-android-assistant/tree/master/app) to see how to use Aimybox library in your own project. # Documentation There is a full Aimybox documentation available [here](https://help.aimybox.com). It's better to start with our [Quick Start](https://help.aimybox.com/en/article/quick-start-s9rswy/) to make first steps with Aimybox.