edge-intelligence-sdk 0.3.9 → 0.3.10
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 +40 -4
- package/android/jniLibs/arm64-v8a/libel_ffi.so +0 -0
- package/ios/libel_ffi.a +0 -0
- package/package.json +1 -1
- package/src/web/README.md +59 -4
- package/src/web/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,8 +3,44 @@
|
|
|
3
3
|
Generated Web and React Native bindings for the Edge Intelligence SDK.
|
|
4
4
|
|
|
5
5
|
This package contains the WASM/TypeScript browser surface, React Native
|
|
6
|
-
TypeScript bindings, and native Android/iOS libraries assembled by the
|
|
7
|
-
|
|
6
|
+
TypeScript bindings, and native Android/iOS libraries assembled by the release
|
|
7
|
+
pipeline.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Copy the Qwen2.5 0.5B GGUF into app storage and pass that local path to the SDK
|
|
12
|
+
facade.
|
|
13
|
+
|
|
14
|
+
Browser / WASM:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import init, { EdgeLlm } from "edge-intelligence-sdk";
|
|
18
|
+
|
|
19
|
+
await init();
|
|
20
|
+
|
|
21
|
+
const qwen05b = "/models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
22
|
+
const sdk = new EdgeLlm(qwen05b);
|
|
23
|
+
const reply = sdk.ask_wasm("Summarize edge inference in one sentence.");
|
|
24
|
+
|
|
25
|
+
console.log(reply);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
React Native:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { EdgeLlm } from "edge-intelligence-sdk";
|
|
32
|
+
|
|
33
|
+
const qwen05b = "/data/user/0/com.example.app/files/models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
34
|
+
const sdk = EdgeLlm.local(qwen05b);
|
|
35
|
+
|
|
36
|
+
const reply = sdk.ask("Summarize edge inference in one sentence.");
|
|
37
|
+
let streamed = "";
|
|
38
|
+
sdk.ask_stream_cb("Give me two deployment tips.", {
|
|
39
|
+
on_token(token) {
|
|
40
|
+
streamed += token;
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Source, crate documentation, and release notes live in the Edge Intelligence
|
|
46
|
+
repository.
|
|
Binary file
|
package/ios/libel_ffi.a
CHANGED
|
Binary file
|
package/package.json
CHANGED
package/src/web/README.md
CHANGED
|
@@ -34,19 +34,74 @@ No `unsafe` (`#![forbid(unsafe_code)]`). The crate is `cdylib` + `staticlib` +
|
|
|
34
34
|
|
|
35
35
|
## Usage (Rust side)
|
|
36
36
|
|
|
37
|
+
Use the Qwen2.5 0.5B GGUF as the local model URI when constructing the facade.
|
|
38
|
+
Native package bindings use the same model path after copying the file into app
|
|
39
|
+
storage. For full Rust ChatML/tokenizer control, use
|
|
40
|
+
`el_engine_candle::QwenChatProvider` directly.
|
|
41
|
+
|
|
37
42
|
```rust
|
|
38
43
|
use el_ffi::EdgeLlm;
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let
|
|
45
|
+
const QWEN_0_5B_GGUF: &str = "models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
46
|
+
|
|
47
|
+
let sdk = EdgeLlm::local(QWEN_0_5B_GGUF.into())?;
|
|
48
|
+
let reply = sdk.ask("Summarize edge inference in one sentence.".into())?;
|
|
43
49
|
assert!(!reply.is_empty());
|
|
44
50
|
|
|
45
51
|
// Streaming (Flutter / closure form):
|
|
46
|
-
sdk.ask_stream("
|
|
52
|
+
sdk.ask_stream("Give me two deployment tips.".into(), |fragment| print!("{fragment}"))?;
|
|
47
53
|
# Ok::<(), el_ffi::SdkError>(())
|
|
48
54
|
```
|
|
49
55
|
|
|
56
|
+
## Usage (npm / web)
|
|
57
|
+
|
|
58
|
+
The npm package exposes the wasm-bindgen browser surface. The local web path
|
|
59
|
+
currently exercises the generated API shape while Candle-on-wasm is being wired;
|
|
60
|
+
native React Native builds load the GGUF through the same package.
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import init, { EdgeLlm } from "edge-intelligence-sdk";
|
|
64
|
+
|
|
65
|
+
await init();
|
|
66
|
+
|
|
67
|
+
const qwen05b = "/models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
68
|
+
const sdk = new EdgeLlm(qwen05b);
|
|
69
|
+
const reply = sdk.ask_wasm("Summarize edge inference in one sentence.");
|
|
70
|
+
|
|
71
|
+
console.log(reply);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Usage (React Native)
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { EdgeLlm } from "edge-intelligence-sdk";
|
|
78
|
+
|
|
79
|
+
const qwen05b = "/data/user/0/com.example.app/files/models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
80
|
+
const sdk = EdgeLlm.local(qwen05b);
|
|
81
|
+
|
|
82
|
+
const reply = sdk.ask("Summarize edge inference in one sentence.");
|
|
83
|
+
let streamed = "";
|
|
84
|
+
sdk.ask_stream_cb("Give me two deployment tips.", {
|
|
85
|
+
on_token(token) {
|
|
86
|
+
streamed += token;
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Usage (pub.dev / Flutter)
|
|
92
|
+
|
|
93
|
+
```dart
|
|
94
|
+
import "package:edge_intelligence/edge_intelligence.dart";
|
|
95
|
+
|
|
96
|
+
final qwen05b = "/path/to/app/models/qwen2.5-0.5b-instruct-q4_k_m.gguf";
|
|
97
|
+
final sdk = await EdgeLlm.local(qwen05b);
|
|
98
|
+
|
|
99
|
+
final reply = await sdk.ask("Summarize edge inference in one sentence.");
|
|
100
|
+
await for (final token in sdk.askStream("Give me two deployment tips.")) {
|
|
101
|
+
stdout.write(token);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
50
105
|
## Building the bindings
|
|
51
106
|
|
|
52
107
|
The Rust binding *surfaces* compile on the host; the cross-target builds and
|
package/src/web/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "el-ffi",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Host bindings: uniffi-bindgen-react-native (RN), flutter_rust_bridge v2 (Flutter), wasm-bindgen (web) — ADR-001/009.",
|
|
5
|
-
"version": "0.3.
|
|
5
|
+
"version": "0.3.10",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"files": [
|
|
8
8
|
"el_ffi_bg.wasm",
|