// Add to your build.gradle.kts
dependencies {
implementation("com.karl:karl-core:x.y.z")
implementation("com.karl:karl-kldl:x.y.z")
implementation("com.karl:karl-room:x.y.z")
implementation("com.karl:karl-compose-ui:x.y.z") // Optional
}
// Create a KARL container for a user
val container = Karl.forUser("user_123")
.withLearningEngine(KLDLLearningEngine())
.withDataStorage(RoomDataStorage(dao))
.withDataSource(applicationDataSource)
.withCoroutineScope(applicationScope)
.build()
// Initialize and start learning
container.initialize()
// Feed interaction data
dataSource.recordInteraction(InteractionData(
type = "button_click",
details = mapOf("action" to "save_document"),
timestamp = System.currentTimeMillis(),
userId = "user_123"
))
// Get AI predictions
container.getPredictions().collect { prediction ->
// Use AI insights in your application
when (prediction.type) {
"suggestion" -> showSuggestion(prediction.content)
"warning" -> showWarning(prediction.content)
}
}