Skip to content

Commit b81095e

Browse files
Merge pull request #447 from RunanywhereAI/Rag+CPP_optis
Cpp optis
2 parents 7be8565 + 77da6c8 commit b81095e

191 files changed

Lines changed: 36770 additions & 5456 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Package.resolved

Lines changed: 0 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ let package = Package(
8686
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.0.0"),
8787
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.9.0"),
8888
.package(url: "https://github.com/JohnSundell/Files.git", from: "4.3.0"),
89-
.package(url: "https://github.com/weichsel/ZIPFoundation.git", from: "0.9.0"),
9089
.package(url: "https://github.com/devicekit/DeviceKit.git", from: "5.6.0"),
91-
.package(url: "https://github.com/tsolomko/SWCompression.git", from: "4.8.0"),
9290
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.40.0"),
9391
// ml-stable-diffusion for CoreML-based image generation
9492
.package(url: "https://github.com/apple/ml-stable-diffusion.git", from: "1.1.0"),
@@ -139,9 +137,7 @@ let package = Package(
139137
.product(name: "Crypto", package: "swift-crypto"),
140138
.product(name: "Alamofire", package: "Alamofire"),
141139
.product(name: "Files", package: "Files"),
142-
.product(name: "ZIPFoundation", package: "ZIPFoundation"),
143140
.product(name: "DeviceKit", package: "DeviceKit"),
144-
.product(name: "SWCompression", package: "SWCompression"),
145141
.product(name: "Sentry", package: "sentry-cocoa"),
146142
.product(name: "StableDiffusion", package: "ml-stable-diffusion"),
147143
"CRACommons",

Playground/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ A complete on-device voice AI pipeline for Linux (Raspberry Pi 5, x86_64, ARM64)
4242
- **Large Language Model** — Qwen2.5 0.5B Q4 via llama.cpp (fully local)
4343
- **Text-to-Speech** — Piper Lessac Medium neural TTS
4444

45-
**Requirements:** Linux (ALSA), x86_64 or ARM64, CMake 3.16+, C++17
45+
**Requirements:** Linux (ALSA), x86_64 or ARM64, CMake 3.16+, C++20
4646

4747
## swift-starter-app
4848

@@ -94,4 +94,4 @@ A hybrid voice assistant that combines on-device AI inference with cloud LLM rea
9494
- **Barge-in Support** — Wake word during TTS playback cancels speech and re-listens
9595
- **Waiting Chime** — Earcon feedback while waiting for cloud response
9696

97-
**Requirements:** Linux (ALSA), x86_64 or ARM64, CMake 3.16+, C++17
97+
**Requirements:** Linux (ALSA), x86_64 or ARM64, CMake 3.16+, C++20

Playground/linux-voice-assistant/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ project(linux-voice-assistant
3131
DESCRIPTION "Linux Voice Assistant using RunAnywhere Commons"
3232
)
3333

34-
set(CMAKE_CXX_STANDARD 17)
34+
set(CMAKE_CXX_STANDARD 20)
3535
set(CMAKE_CXX_STANDARD_REQUIRED ON)
3636

3737
# =============================================================================

Playground/linux-voice-assistant/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ linux-voice-assistant/
5656

5757
- Linux (Raspberry Pi 5, Ubuntu, Debian, etc.)
5858
- CMake 3.16+
59-
- C++17 compiler (g++ or clang++)
59+
- C++20 compiler (g++ or clang++)
6060
- ALSA development headers: `sudo apt install libasound2-dev`
6161

6262
### Build and Run

Playground/openclaw-hybrid-assistant/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.16)
22
project(openclaw-hybrid-assistant VERSION 0.1.0 LANGUAGES CXX)
33

4-
set(CMAKE_CXX_STANDARD 17)
4+
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66

77
# =============================================================================

examples/flutter/RunAnywhereAI/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,21 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
2020
} catch (Exception e) {
2121
Log.e(TAG, "Error registering plugin audioplayers_android, xyz.luan.audioplayers.AudioplayersPlugin", e);
2222
}
23+
try {
24+
flutterEngine.getPlugins().add(new io.flutter.plugins.camerax.CameraAndroidCameraxPlugin());
25+
} catch (Exception e) {
26+
Log.e(TAG, "Error registering plugin camera_android_camerax, io.flutter.plugins.camerax.CameraAndroidCameraxPlugin", e);
27+
}
2328
try {
2429
flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.device_info.DeviceInfoPlusPlugin());
2530
} catch (Exception e) {
2631
Log.e(TAG, "Error registering plugin device_info_plus, dev.fluttercommunity.plus.device_info.DeviceInfoPlusPlugin", e);
2732
}
33+
try {
34+
flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
35+
} catch (Exception e) {
36+
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
37+
}
2838
try {
2939
flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());
3040
} catch (Exception e) {
@@ -35,6 +45,11 @@ public static void registerWith(@NonNull FlutterEngine flutterEngine) {
3545
} catch (Exception e) {
3646
Log.e(TAG, "Error registering plugin flutter_tts, com.tundralabs.fluttertts.FlutterTtsPlugin", e);
3747
}
48+
try {
49+
flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
50+
} catch (Exception e) {
51+
Log.e(TAG, "Error registering plugin image_picker_android, io.flutter.plugins.imagepicker.ImagePickerPlugin", e);
52+
}
3853
try {
3954
flutterEngine.getPlugins().add(new dev.fluttercommunity.plus.packageinfo.PackageInfoPlugin());
4055
} catch (Exception e) {

examples/flutter/RunAnywhereAI/ios/Runner/GeneratedPluginRegistrant.m

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
@import audioplayers_darwin;
1313
#endif
1414

15+
#if __has_include(<camera_avfoundation/CameraPlugin.h>)
16+
#import <camera_avfoundation/CameraPlugin.h>
17+
#else
18+
@import camera_avfoundation;
19+
#endif
20+
1521
#if __has_include(<device_info_plus/FPPDeviceInfoPlusPlugin.h>)
1622
#import <device_info_plus/FPPDeviceInfoPlusPlugin.h>
1723
#else
@@ -30,6 +36,12 @@
3036
@import flutter_tts;
3137
#endif
3238

39+
#if __has_include(<image_picker_ios/FLTImagePickerPlugin.h>)
40+
#import <image_picker_ios/FLTImagePickerPlugin.h>
41+
#else
42+
@import image_picker_ios;
43+
#endif
44+
3345
#if __has_include(<package_info_plus/FPPPackageInfoPlusPlugin.h>)
3446
#import <package_info_plus/FPPPackageInfoPlusPlugin.h>
3547
#else
@@ -94,9 +106,11 @@ @implementation GeneratedPluginRegistrant
94106

95107
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
96108
[AudioplayersDarwinPlugin registerWithRegistrar:[registry registrarForPlugin:@"AudioplayersDarwinPlugin"]];
109+
[CameraPlugin registerWithRegistrar:[registry registrarForPlugin:@"CameraPlugin"]];
97110
[FPPDeviceInfoPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPDeviceInfoPlusPlugin"]];
98111
[FlutterSecureStoragePlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterSecureStoragePlugin"]];
99112
[FlutterTtsPlugin registerWithRegistrar:[registry registrarForPlugin:@"FlutterTtsPlugin"]];
113+
[FLTImagePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImagePickerPlugin"]];
100114
[FPPPackageInfoPlusPlugin registerWithRegistrar:[registry registrarForPlugin:@"FPPPackageInfoPlusPlugin"]];
101115
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
102116
[PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]];

examples/flutter/RunAnywhereAI/lib/app/runanywhere_ai_app.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:runanywhere_ai/core/utilities/constants.dart';
1212
import 'package:runanywhere_ai/core/utilities/keychain_helper.dart';
1313
import 'package:runanywhere/public/extensions/rag_module.dart';
1414
import 'package:runanywhere_llamacpp/runanywhere_llamacpp.dart';
15+
import 'package:runanywhere_onnx/runanywhere_onnx.dart';
1516

1617
/// RunAnywhereAIApp (mirroring iOS RunAnywhereAIApp.swift)
1718
///
@@ -286,6 +287,14 @@ class _RunAnywhereAIAppState extends State<RunAnywhereAIApp> {
286287
debugPrint('✅ ONNX Embedding models registered');
287288
await Future<void>.delayed(Duration.zero);
288289

290+
// --- ONNX BACKEND (required for embeddings used by RAG) ---
291+
try {
292+
await Onnx.register();
293+
debugPrint('✅ ONNX backend registered (STT + TTS + VAD + Embeddings)');
294+
} catch (e) {
295+
debugPrint('⚠️ ONNX backend not available: $e');
296+
}
297+
289298
// --- RAG BACKEND ---
290299
try {
291300
await RAGModule.register();

examples/flutter/RunAnywhereAI/lib/features/vision/vlm_view_model.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class VLMViewModel extends ChangeNotifier {
161161
final result = await sdk.RunAnywhere.processImageStream(
162162
image,
163163
prompt: 'Describe what you see briefly.',
164-
maxTokens: 200,
164+
options: const sdk.VLMGenerationOptions(maxTokens: 200),
165165
);
166166

167167
// Listen to stream and append tokens
@@ -201,7 +201,7 @@ class VLMViewModel extends ChangeNotifier {
201201
final result = await sdk.RunAnywhere.processImageStream(
202202
image,
203203
prompt: 'Describe this image in detail.',
204-
maxTokens: 300,
204+
options: const sdk.VLMGenerationOptions(maxTokens: 300),
205205
);
206206

207207
// Listen to stream and append tokens
@@ -285,7 +285,7 @@ class VLMViewModel extends ChangeNotifier {
285285
final result = await sdk.RunAnywhere.processImageStream(
286286
image,
287287
prompt: 'Describe what you see in one sentence.',
288-
maxTokens: 100,
288+
options: const sdk.VLMGenerationOptions(maxTokens: 100),
289289
);
290290

291291
// Listen to stream and build description

0 commit comments

Comments
 (0)