cactus-react-native 1.0.1 → 1.1.0
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 +609 -56
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +23 -15
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +12 -9
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +42 -41
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusImage.kt +81 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
- package/cpp/HybridCactus.cpp +161 -44
- package/cpp/HybridCactus.hpp +34 -14
- package/cpp/HybridCactusUtil.cpp +13 -11
- package/cpp/HybridCactusUtil.hpp +9 -9
- package/cpp/cactus_ffi.h +28 -1
- package/ios/HybridCactusImage.swift +53 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +28 -1
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +237 -7
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ffi_utils.h +158 -43
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +23 -2
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +52 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +28 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +237 -7
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/ffi_utils.h +158 -43
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +23 -2
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +52 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/lib/module/api/Database.js +23 -0
- package/lib/module/api/Database.js.map +1 -1
- package/lib/module/api/RemoteLM.js +201 -0
- package/lib/module/api/RemoteLM.js.map +1 -0
- package/lib/module/classes/CactusLM.js +56 -28
- package/lib/module/classes/CactusLM.js.map +1 -1
- package/lib/module/classes/CactusSTT.js +137 -0
- package/lib/module/classes/CactusSTT.js.map +1 -0
- package/lib/module/config/CactusConfig.js +4 -0
- package/lib/module/config/CactusConfig.js.map +1 -1
- package/lib/module/constants/packageVersion.js +1 -1
- package/lib/module/hooks/useCactusLM.js +44 -16
- package/lib/module/hooks/useCactusLM.js.map +1 -1
- package/lib/module/hooks/useCactusSTT.js +234 -0
- package/lib/module/hooks/useCactusSTT.js.map +1 -0
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Cactus.js +52 -3
- package/lib/module/native/Cactus.js.map +1 -1
- package/lib/module/native/CactusFileSystem.js +2 -3
- package/lib/module/native/CactusFileSystem.js.map +1 -1
- package/lib/module/native/CactusImage.js +13 -0
- package/lib/module/native/CactusImage.js.map +1 -0
- package/lib/module/native/index.js +1 -0
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/specs/CactusImage.nitro.js +4 -0
- package/lib/module/specs/CactusImage.nitro.js.map +1 -0
- package/lib/module/telemetry/Telemetry.js +53 -1
- package/lib/module/telemetry/Telemetry.js.map +1 -1
- package/lib/module/types/CactusSTT.js +2 -0
- package/lib/module/types/CactusSTT.js.map +1 -0
- package/lib/typescript/src/api/Database.d.ts +1 -0
- package/lib/typescript/src/api/Database.d.ts.map +1 -1
- package/lib/typescript/src/api/RemoteLM.d.ts +14 -0
- package/lib/typescript/src/api/RemoteLM.d.ts.map +1 -0
- package/lib/typescript/src/classes/CactusLM.d.ts +8 -5
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/classes/CactusSTT.d.ts +25 -0
- package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -1
- package/lib/typescript/src/constants/packageVersion.d.ts +1 -1
- package/lib/typescript/src/hooks/useCactusLM.d.ts +5 -4
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useCactusSTT.d.ts +20 -0
- package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/Cactus.d.ts +10 -3
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusFileSystem.d.ts +1 -1
- package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -1
- package/lib/typescript/src/native/CactusImage.d.ts +6 -0
- package/lib/typescript/src/native/CactusImage.d.ts.map +1 -0
- package/lib/typescript/src/native/index.d.ts +1 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +4 -1
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
- package/lib/typescript/src/specs/CactusImage.nitro.d.ts +9 -0
- package/lib/typescript/src/specs/CactusImage.nitro.d.ts.map +1 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts +5 -1
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusLM.d.ts +11 -6
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
- package/lib/typescript/src/types/CactusSTT.d.ts +37 -0
- package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -0
- package/nitro.json +4 -0
- package/nitrogen/generated/android/c++/JHybridCactusImageSpec.cpp +81 -0
- package/nitrogen/generated/android/c++/JHybridCactusImageSpec.hpp +66 -0
- package/nitrogen/generated/android/cactus+autolinking.cmake +2 -0
- package/nitrogen/generated/android/cactusOnLoad.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusImageSpec.kt +62 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +17 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +5 -0
- package/nitrogen/generated/ios/CactusAutolinking.mm +8 -0
- package/nitrogen/generated/ios/CactusAutolinking.swift +15 -0
- package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.hpp +85 -0
- package/nitrogen/generated/ios/swift/HybridCactusImageSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridCactusImageSpec_cxx.swift +158 -0
- package/nitrogen/generated/shared/c++/HybridCactusImageSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridCactusImageSpec.hpp +64 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +4 -1
- package/package.json +1 -1
- package/src/api/Database.ts +27 -0
- package/src/api/RemoteLM.ts +273 -0
- package/src/classes/CactusLM.ts +76 -40
- package/src/classes/CactusSTT.ts +182 -0
- package/src/config/CactusConfig.ts +4 -0
- package/src/constants/packageVersion.ts +1 -1
- package/src/hooks/useCactusLM.ts +53 -22
- package/src/hooks/useCactusSTT.ts +285 -0
- package/src/index.tsx +14 -2
- package/src/native/Cactus.ts +100 -6
- package/src/native/CactusFileSystem.ts +2 -2
- package/src/native/CactusImage.ts +20 -0
- package/src/native/index.ts +1 -0
- package/src/specs/Cactus.nitro.ts +14 -1
- package/src/specs/CactusImage.nitro.ts +12 -0
- package/src/telemetry/Telemetry.ts +78 -1
- package/src/types/CactusLM.ts +12 -6
- package/src/types/CactusSTT.ts +42 -0
package/src/types/CactusLM.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export interface CactusLMParams {
|
|
2
2
|
model?: string;
|
|
3
3
|
contextSize?: number;
|
|
4
|
+
corpusDir?: string;
|
|
4
5
|
}
|
|
5
6
|
|
|
6
7
|
export interface CactusLMDownloadParams {
|
|
@@ -9,10 +10,11 @@ export interface CactusLMDownloadParams {
|
|
|
9
10
|
|
|
10
11
|
export interface Message {
|
|
11
12
|
role: 'user' | 'assistant' | 'system';
|
|
12
|
-
content
|
|
13
|
+
content?: string;
|
|
14
|
+
images?: string[];
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export interface
|
|
17
|
+
export interface CompleteOptions {
|
|
16
18
|
temperature?: number;
|
|
17
19
|
topP?: number;
|
|
18
20
|
topK?: number;
|
|
@@ -21,7 +23,6 @@ export interface Options {
|
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export interface Tool {
|
|
24
|
-
type: 'function';
|
|
25
26
|
name: string;
|
|
26
27
|
description: string;
|
|
27
28
|
parameters: {
|
|
@@ -38,9 +39,10 @@ export interface Tool {
|
|
|
38
39
|
|
|
39
40
|
export interface CactusLMCompleteParams {
|
|
40
41
|
messages: Message[];
|
|
41
|
-
options?:
|
|
42
|
+
options?: CompleteOptions;
|
|
42
43
|
tools?: Tool[];
|
|
43
44
|
onToken?: (token: string) => void;
|
|
45
|
+
mode?: 'local' | 'hybrid';
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
export interface CactusLMCompleteResult {
|
|
@@ -66,6 +68,10 @@ export interface CactusLMEmbedResult {
|
|
|
66
68
|
embedding: number[];
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
export interface
|
|
70
|
-
|
|
71
|
+
export interface CactusLMImageEmbedParams {
|
|
72
|
+
imagePath: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface CactusLMImageEmbedResult {
|
|
76
|
+
embedding: number[];
|
|
71
77
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface CactusSTTParams {
|
|
2
|
+
model?: string;
|
|
3
|
+
contextSize?: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface CactusSTTDownloadParams {
|
|
7
|
+
onProgress?: (progress: number) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface TranscribeOptions {
|
|
11
|
+
temperature?: number;
|
|
12
|
+
topP?: number;
|
|
13
|
+
topK?: number;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
stopSequences?: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface CactusSTTTranscribeParams {
|
|
19
|
+
audioFilePath: string;
|
|
20
|
+
prompt?: string;
|
|
21
|
+
options?: TranscribeOptions;
|
|
22
|
+
onToken?: (token: string) => void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface CactusSTTTranscribeResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
response: string;
|
|
28
|
+
timeToFirstTokenMs: number;
|
|
29
|
+
totalTimeMs: number;
|
|
30
|
+
tokensPerSecond: number;
|
|
31
|
+
prefillTokens: number;
|
|
32
|
+
decodeTokens: number;
|
|
33
|
+
totalTokens: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface CactusSTTAudioEmbedParams {
|
|
37
|
+
audioPath: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CactusSTTAudioEmbedResult {
|
|
41
|
+
embedding: number[];
|
|
42
|
+
}
|