Skip to content

Commit 8909ef8

Browse files
Merge pull request #3188 from annietllnd/BmanClark/main
Technical review of Android AI Chat LP
2 parents ea3f8ba + 4c1d95c commit 8909ef8

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

content/learning-paths/mobile-graphics-and-gaming/android-ai-chat-lib/_index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
---
22
title: Add an LLM to your Android app with Arm's AI Chat library
3+
draft: true
4+
cascade:
5+
draft: true
36

47
minutes_to_complete: 15
58

6-
who_is_this_for: Android App Developers who wish to add LLM capabilities to an app.
9+
who_is_this_for: This is an introductory topic for developers who want to add a local, on-device LLM chat experience using Arm's AI Chat library, Kotlin, and Android Studio.
710

811
learning_objectives:
9-
- Easily add an on-device LLM to any Android app
12+
- Create a simple Android chatbot app scaffold in Android Studio
13+
- Load a mobile-friendly GGUF model on-device and run streamed chat inference
1014

1115
prerequisites:
1216
- Android Studio

content/learning-paths/mobile-graphics-and-gaming/android-ai-chat-lib/add-ai-chat-lib-2.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ This adds the library to your project, and all the LLM functionality. Also in th
2121
- the Java version in `compileOptions` is `JavaVersion.VERSION_17`
2222
- the `jvmTarget` in `kotlinOptions` is 17
2323

24-
In `libs.version.toml` we need to change the `kotlin` version to `2.2.20`, as the library requires a more recent version than the default.
24+
In `libs.version.toml`, check that:
25+
- `kotlin` version is `2.2.20`
2526

2627
Finally, there will be a banner at the top of these settings files saying the "Gradle files have changed since last project sync." Choose the option to "Sync Now", and let the project update.
2728

content/learning-paths/mobile-graphics-and-gaming/android-ai-chat-lib/add-layouts-adapter-3.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ layout: learningpathall
77
---
88

99
## Add Layouts
10-
Currently the `activity_main.xml` layout file in your `app\src\res\layout` directory is nearly empty, containing just a "Hello World!" piece of text that we wish to remove. Instead, replace it with the following, which will create a status area at the top, a place for messages in the middle, and a place for you to type at the bottom with a button to send:
10+
Currently the `activity_main.xml` layout file in your `app\src\main\res\layout` directory is nearly empty, containing just a "Hello World!" piece of text that we wish to remove. Instead, replace it with the following, which will create a status area at the top, a place for messages in the middle, and a place for you to type at the bottom with a button to send:
1111
```xml
1212
<?xml version="1.0" encoding="utf-8"?>
1313
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
@@ -117,7 +117,12 @@ Then create `item_message_assistant.xml` and put the following as its contents:
117117
## Add the MessageAdaptor class
118118
As a final bit of UI code, we add a `MessageAdapter.kt` code file to put our messages into the correct bit of layout. The file should sit alongside the `MainActivity` class that is auto-created with the project.
119119

120+
{{% notice Package name %}}
121+
The `package` name below has to match that of your project name. If you named your project `simpleaichat`, you can copy the block without changes. If you named your project differently as you started out this Learning Path, make sure you update it after populating the file.
122+
{{% /notice %}}
123+
120124
The file contents of `MessageAdapter.kt` are:
125+
121126
```kotlin
122127
package com.example.simpleaichat
123128

content/learning-paths/mobile-graphics-and-gaming/android-ai-chat-lib/setup-1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ For other examples of chatbots using this library you can use:
1616
- the [AI Chat library GitHub example](https://github.com/arm/ai-chat/tree/use-maven-library/examples/llama.android), which is only slightly more complicated than this Learning Path.
1717

1818
## Project Setup
19-
Open Android Studio and create a new project of the type "Empty Views Activity". Name it however you like, and leave other options on default - for instance Minimum SDK will be 33.
19+
Open Android Studio and create a new project of the type "Empty Views Activity". Name it `simpleaichat`, and set the Minimum SDK to 33.
2020

0 commit comments

Comments
 (0)