expo-ai-kit 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,26 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
On-device AI for Expo apps. Run language models locally—no API keys, no cloud, just native intelligence.
|
|
4
4
|
|
|
5
|
+
[](https://www.npmjs.com/package/expo-ai-kit)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
5
8
|
## Platform Support
|
|
6
9
|
|
|
7
|
-
| Platform | Status |
|
|
8
|
-
|
|
9
|
-
| iOS 26+ | ✅ Full support |
|
|
10
|
-
| Android | ✅ [
|
|
11
|
-
| iOS < 26 | ⚠️ Returns mock responses |
|
|
12
|
-
| Android (unsupported
|
|
10
|
+
| Platform | Status | Details |
|
|
11
|
+
|----------|--------|---------|
|
|
12
|
+
| iOS 26+ | ✅ Full support | Apple Foundation Models |
|
|
13
|
+
| Android | ✅ Full support | [ML Kit Prompt API](https://developers.google.com/ml-kit/genai#prompt-device) |
|
|
14
|
+
| iOS < 26 | ⚠️ Limited | Returns mock responses |
|
|
15
|
+
| Android (unsupported) | ⚠️ Limited | Returns empty string |
|
|
13
16
|
|
|
14
17
|
## Features
|
|
15
18
|
|
|
16
|
-
- 🔒 **Privacy-first** — All inference happens on-device
|
|
17
|
-
- ⚡ **Zero latency** — No network round-trips
|
|
18
|
-
- 🆓 **Free** — No API costs
|
|
19
|
-
- 📱 **Native** — Built on Apple Foundation Models (iOS) and ML Kit Prompt API (Android)
|
|
19
|
+
- 🔒 **Privacy-first** — All inference happens on-device; no data leaves the user's device
|
|
20
|
+
- ⚡ **Zero latency** — No network round-trips required
|
|
21
|
+
- 🆓 **Free forever** — No API costs, rate limits, or subscriptions
|
|
22
|
+
- 📱 **Native performance** — Built on Apple Foundation Models (iOS) and Google ML Kit Prompt API (Android)
|
|
23
|
+
- 💬 **Multi-turn conversations** — Session-based chat with full conversation context
|
|
24
|
+
- 🎛️ **Configurable** — Temperature and max tokens control for response generation
|
|
20
25
|
|
|
21
26
|
## Requirements
|
|
22
27
|
|
|
23
28
|
- Expo SDK 54+
|
|
24
|
-
- **iOS:** iOS 26.0+
|
|
29
|
+
- **iOS:** iOS 26.0+ (full support), iOS 15.1+ (limited)
|
|
25
30
|
- **Android:** API 26+, [Supported devices](https://developers.google.com/ml-kit/genai#prompt-device)
|
|
26
31
|
|
|
27
32
|
## Installation
|
|
@@ -32,6 +37,27 @@ npx expo install expo-ai-kit
|
|
|
32
37
|
|
|
33
38
|
For bare React Native projects, run `npx pod-install` after installing.
|
|
34
39
|
|
|
40
|
+
### Android Configuration
|
|
41
|
+
|
|
42
|
+
For Android, ensure your `app.json` includes the minimum SDK version:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"expo": {
|
|
47
|
+
"plugins": [
|
|
48
|
+
[
|
|
49
|
+
"expo-build-properties",
|
|
50
|
+
{
|
|
51
|
+
"android": {
|
|
52
|
+
"minSdkVersion": 26
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
35
61
|
## Quick Start
|
|
36
62
|
|
|
37
63
|
```tsx
|
|
@@ -69,7 +95,7 @@ async function askAI(question: string) {
|
|
|
69
95
|
const answer = await askAI('What is the capital of France?');
|
|
70
96
|
```
|
|
71
97
|
|
|
72
|
-
### Session-based Chat
|
|
98
|
+
### Session-based Chat
|
|
73
99
|
|
|
74
100
|
For multi-turn conversations with context, use sessions:
|
|
75
101
|
|
|
@@ -87,7 +113,7 @@ const { reply } = await sendMessage(sessionId, [
|
|
|
87
113
|
]);
|
|
88
114
|
```
|
|
89
115
|
|
|
90
|
-
### Multi-turn Conversations
|
|
116
|
+
### Multi-turn Conversations
|
|
91
117
|
|
|
92
118
|
Keep track of the conversation history for context-aware responses:
|
|
93
119
|
|
|
@@ -212,7 +238,7 @@ Sends a prompt and gets a response from the on-device model.
|
|
|
212
238
|
|
|
213
239
|
---
|
|
214
240
|
|
|
215
|
-
### `createSession(options?)` — iOS
|
|
241
|
+
### `createSession(options?)` — iOS, Android
|
|
216
242
|
|
|
217
243
|
Creates a new chat session for multi-turn conversations.
|
|
218
244
|
|
|
@@ -224,7 +250,7 @@ Creates a new chat session for multi-turn conversations.
|
|
|
224
250
|
|
|
225
251
|
---
|
|
226
252
|
|
|
227
|
-
### `sendMessage(sessionId, messages, options?)` — iOS
|
|
253
|
+
### `sendMessage(sessionId, messages, options?)` — iOS, Android
|
|
228
254
|
|
|
229
255
|
Sends messages and gets a response from the on-device model with conversation context.
|
|
230
256
|
|
|
@@ -239,7 +265,7 @@ Sends messages and gets a response from the on-device model with conversation co
|
|
|
239
265
|
|
|
240
266
|
---
|
|
241
267
|
|
|
242
|
-
### `prepareModel(options?)` — iOS
|
|
268
|
+
### `prepareModel(options?)` — iOS, Android
|
|
243
269
|
|
|
244
270
|
Pre-loads the model for faster first response.
|
|
245
271
|
|
|
@@ -251,7 +277,7 @@ Pre-loads the model for faster first response.
|
|
|
251
277
|
|
|
252
278
|
---
|
|
253
279
|
|
|
254
|
-
### Types
|
|
280
|
+
### Types
|
|
255
281
|
|
|
256
282
|
```typescript
|
|
257
283
|
type LLMRole = 'system' | 'user' | 'assistant';
|
|
@@ -268,6 +294,37 @@ type LLMOptions = {
|
|
|
268
294
|
};
|
|
269
295
|
```
|
|
270
296
|
|
|
297
|
+
## Feature Comparison
|
|
298
|
+
|
|
299
|
+
| Feature | iOS 26+ | Android (Supported) |
|
|
300
|
+
|---------|---------|---------------------|
|
|
301
|
+
| `isAvailable()` | ✅ | ✅ |
|
|
302
|
+
| `sendPrompt()` | ✅ | ✅ |
|
|
303
|
+
| `createSession()` | ✅ Full context | ✅ Basic |
|
|
304
|
+
| `sendMessage()` | ✅ Full context | ✅ Basic |
|
|
305
|
+
| `prepareModel()` | ✅ | ✅ No-op |
|
|
306
|
+
| System prompts | ✅ | ✅ |
|
|
307
|
+
| Temperature control | ✅ | ✅ |
|
|
308
|
+
| Max tokens control | ✅ | ✅ |
|
|
309
|
+
|
|
310
|
+
## How It Works
|
|
311
|
+
|
|
312
|
+
### iOS
|
|
313
|
+
Uses Apple's Foundation Models framework introduced in iOS 26. The on-device language model runs entirely locally with no internet connection required.
|
|
314
|
+
|
|
315
|
+
### Android
|
|
316
|
+
Uses Google's ML Kit Prompt API. The model may need to be downloaded on first use on supported devices. Check [supported devices](https://developers.google.com/ml-kit/genai#prompt-device) for compatibility.
|
|
317
|
+
|
|
318
|
+
## Troubleshooting
|
|
319
|
+
|
|
320
|
+
### iOS
|
|
321
|
+
- **AI not available**: Ensure you're running iOS 26.0 or later on a supported device
|
|
322
|
+
- **Mock responses**: On iOS < 26, the module returns mock responses for testing
|
|
323
|
+
|
|
324
|
+
### Android
|
|
325
|
+
- **Empty responses**: The device may not support ML Kit Prompt API. Check the [supported devices list](https://developers.google.com/ml-kit/genai#prompt-device)
|
|
326
|
+
- **Model downloading**: On first use, the model may need to download. Use `isAvailable()` to check status
|
|
327
|
+
|
|
271
328
|
## License
|
|
272
329
|
|
|
273
330
|
MIT
|
|
@@ -275,3 +332,11 @@ MIT
|
|
|
275
332
|
## Contributing
|
|
276
333
|
|
|
277
334
|
Contributions are welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
|
|
335
|
+
|
|
336
|
+
## Links
|
|
337
|
+
|
|
338
|
+
- [Documentation](https://expo-ai-kit.com)
|
|
339
|
+
- [npm package](https://www.npmjs.com/package/expo-ai-kit)
|
|
340
|
+
- [GitHub repository](https://github.com/laraelmas/expo-ai-kit)
|
|
341
|
+
- [Apple Foundation Models](https://developer.apple.com/documentation/foundationmodels)
|
|
342
|
+
- [Google ML Kit Prompt API](https://developers.google.com/ml-kit/genai)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-ai-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Expo AI Kit module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"author": "Lara Elmas (https://github.com/laraelmas)",
|
|
42
42
|
"license": "MIT",
|
|
43
|
-
"homepage": "https://
|
|
43
|
+
"homepage": "https://expo-ai-kit.com",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"expo": "~54.0.27",
|
|
46
46
|
"react": "19.1.0",
|