llama-cpp-capacitor 0.0.12 → 0.0.21
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/LlamaCpp.podspec +17 -17
- package/Package.swift +27 -27
- package/README.md +717 -574
- package/android/build.gradle +88 -69
- package/android/src/main/AndroidManifest.xml +2 -2
- package/android/src/main/CMakeLists-arm64.txt +131 -0
- package/android/src/main/CMakeLists-x86_64.txt +135 -0
- package/android/src/main/CMakeLists.txt +35 -52
- package/android/src/main/java/ai/annadata/plugin/capacitor/LlamaCpp.java +956 -717
- package/android/src/main/java/ai/annadata/plugin/capacitor/LlamaCppPlugin.java +710 -590
- package/android/src/main/jni-utils.h +7 -7
- package/android/src/main/jni.cpp +952 -159
- package/cpp/{rn-completion.cpp → cap-completion.cpp} +202 -24
- package/cpp/{rn-completion.h → cap-completion.h} +22 -11
- package/cpp/{rn-llama.cpp → cap-llama.cpp} +81 -27
- package/cpp/{rn-llama.h → cap-llama.h} +32 -20
- package/cpp/{rn-mtmd.hpp → cap-mtmd.hpp} +15 -15
- package/cpp/{rn-tts.cpp → cap-tts.cpp} +12 -12
- package/cpp/{rn-tts.h → cap-tts.h} +14 -14
- package/cpp/ggml-cpu/ggml-cpu-impl.h +30 -0
- package/dist/docs.json +100 -3
- package/dist/esm/definitions.d.ts +45 -2
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +22 -0
- package/dist/esm/index.js +66 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/plugin.cjs.js +71 -3
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +71 -3
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/LlamaCppPlugin/LlamaCpp.swift +596 -596
- package/ios/Sources/LlamaCppPlugin/LlamaCppPlugin.swift +591 -514
- package/ios/Tests/LlamaCppPluginTests/LlamaCppPluginTests.swift +15 -15
- package/package.json +111 -110
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import XCTest
|
|
2
|
-
@testable import LlamaCppPlugin
|
|
3
|
-
|
|
4
|
-
class LlamaCppTests: XCTestCase {
|
|
5
|
-
func testEcho() {
|
|
6
|
-
// This is an example of a functional test case for a plugin.
|
|
7
|
-
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
8
|
-
|
|
9
|
-
let implementation = LlamaCpp()
|
|
10
|
-
let value = "Hello, World!"
|
|
11
|
-
let result = implementation.echo(value)
|
|
12
|
-
|
|
13
|
-
XCTAssertEqual(value, result)
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import XCTest
|
|
2
|
+
@testable import LlamaCppPlugin
|
|
3
|
+
|
|
4
|
+
class LlamaCppTests: XCTestCase {
|
|
5
|
+
func testEcho() {
|
|
6
|
+
// This is an example of a functional test case for a plugin.
|
|
7
|
+
// Use XCTAssert and related functions to verify your tests produce the correct results.
|
|
8
|
+
|
|
9
|
+
let implementation = LlamaCpp()
|
|
10
|
+
let value = "Hello, World!"
|
|
11
|
+
let result = implementation.echo(value)
|
|
12
|
+
|
|
13
|
+
XCTAssertEqual(value, result)
|
|
14
|
+
}
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,110 +1,111 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "llama-cpp-capacitor",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "A native Capacitor plugin that embeds llama.cpp directly into mobile apps, enabling offline AI inference with comprehensive support for text generation, multimodal processing, TTS, LoRA adapters, and more.",
|
|
5
|
-
"main": "dist/plugin.cjs.js",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"android/
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"ios/
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"llama
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"verify
|
|
54
|
-
"verify:
|
|
55
|
-
"verify:
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"build
|
|
64
|
-
"build:
|
|
65
|
-
"build:
|
|
66
|
-
"
|
|
67
|
-
"test
|
|
68
|
-
"test:integration
|
|
69
|
-
"test:integration:
|
|
70
|
-
"test:
|
|
71
|
-
"test:
|
|
72
|
-
"
|
|
73
|
-
"clean
|
|
74
|
-
"clean:
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"@capacitor/
|
|
81
|
-
"@capacitor/
|
|
82
|
-
"@capacitor/
|
|
83
|
-
"@
|
|
84
|
-
"@ionic/
|
|
85
|
-
"@ionic/
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"prettier
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "llama-cpp-capacitor",
|
|
3
|
+
"version": "0.0.21",
|
|
4
|
+
"description": "A native Capacitor plugin that embeds llama.cpp directly into mobile apps, enabling offline AI inference with comprehensive support for text generation, multimodal processing, TTS, LoRA adapters, and more.",
|
|
5
|
+
"main": "dist/plugin.cjs.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"module": "dist/esm/index.js",
|
|
8
|
+
"types": "types/llama-cpp-capacitor.d.ts",
|
|
9
|
+
"unpkg": "dist/plugin.js",
|
|
10
|
+
"files": [
|
|
11
|
+
"android/src/main/",
|
|
12
|
+
"android/build.gradle",
|
|
13
|
+
"cpp/",
|
|
14
|
+
"dist/",
|
|
15
|
+
"ios/Sources",
|
|
16
|
+
"ios/Tests",
|
|
17
|
+
"Package.swift",
|
|
18
|
+
"LlamaCpp.podspec",
|
|
19
|
+
"types/"
|
|
20
|
+
],
|
|
21
|
+
"author": "Yakub Mohammad",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/arusatech/llama-cpp.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/arusatech/llama-cpp/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/arusatech/llama-cpp#readme",
|
|
31
|
+
"keywords": [
|
|
32
|
+
"capacitor",
|
|
33
|
+
"plugin",
|
|
34
|
+
"native",
|
|
35
|
+
"llama",
|
|
36
|
+
"llama.cpp",
|
|
37
|
+
"ai",
|
|
38
|
+
"machine-learning",
|
|
39
|
+
"offline-ai",
|
|
40
|
+
"text-generation",
|
|
41
|
+
"multimodal",
|
|
42
|
+
"tts",
|
|
43
|
+
"text-to-speech",
|
|
44
|
+
"lora",
|
|
45
|
+
"embeddings",
|
|
46
|
+
"reranking",
|
|
47
|
+
"chat-completion",
|
|
48
|
+
"gguf",
|
|
49
|
+
"large-language-model",
|
|
50
|
+
"llm"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
|
|
54
|
+
"verify:ios": "xcodebuild -scheme LlamaCpp -destination generic/platform=iOS",
|
|
55
|
+
"verify:android": "cd android && gradlew.bat clean build test && cd ..",
|
|
56
|
+
"verify:web": "npm run build",
|
|
57
|
+
"lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
|
|
58
|
+
"fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format",
|
|
59
|
+
"eslint": "eslint . --ext ts",
|
|
60
|
+
"prettier": "prettier \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
61
|
+
"swiftlint": "node-swiftlint",
|
|
62
|
+
"docgen": "docgen --api LlamaCppPlugin --output-readme README.md --output-json dist/docs.json",
|
|
63
|
+
"build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
64
|
+
"build:native": "./build-native.sh",
|
|
65
|
+
"build:ios": "cd ios && cmake -B build -S . && cmake --build build --config Release",
|
|
66
|
+
"build:android": "cd android && gradlew.bat assembleRelease",
|
|
67
|
+
"test": "jest",
|
|
68
|
+
"test:integration": "./scripts/test-integration.sh",
|
|
69
|
+
"test:integration:jest": "jest --config test/jest.integration.config.js",
|
|
70
|
+
"test:integration:custom": "ts-node test/integration/test-runner.ts",
|
|
71
|
+
"test:unit": "jest --testPathIgnorePatterns=test/integration",
|
|
72
|
+
"test:coverage": "jest --coverage",
|
|
73
|
+
"clean": "rimraf ./dist",
|
|
74
|
+
"clean:native": "rimraf ios/build android/build android/src/main/jniLibs",
|
|
75
|
+
"clean:test": "rimraf test/output test/coverage",
|
|
76
|
+
"watch": "tsc --watch",
|
|
77
|
+
"prepublishOnly": "npm run build"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@capacitor/android": "^7.0.0",
|
|
81
|
+
"@capacitor/core": "^7.4.3",
|
|
82
|
+
"@capacitor/docgen": "^0.3.0",
|
|
83
|
+
"@capacitor/ios": "^7.0.0",
|
|
84
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
85
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
86
|
+
"@ionic/swiftlint-config": "^2.0.0",
|
|
87
|
+
"eslint": "^8.57.0",
|
|
88
|
+
"prettier": "^3.4.2",
|
|
89
|
+
"prettier-plugin-java": "^2.6.6",
|
|
90
|
+
"rimraf": "^6.0.1",
|
|
91
|
+
"rollup": "^4.30.1",
|
|
92
|
+
"swiftlint": "^2.0.0",
|
|
93
|
+
"typescript": "~4.1.5"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"@capacitor/core": ">=7.0.0"
|
|
97
|
+
},
|
|
98
|
+
"prettier": "@ionic/prettier-config",
|
|
99
|
+
"swiftlint": "@ionic/swiftlint-config",
|
|
100
|
+
"eslintConfig": {
|
|
101
|
+
"extends": "@ionic/eslint-config/recommended"
|
|
102
|
+
},
|
|
103
|
+
"capacitor": {
|
|
104
|
+
"ios": {
|
|
105
|
+
"src": "ios"
|
|
106
|
+
},
|
|
107
|
+
"android": {
|
|
108
|
+
"src": "android"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|