cactus-react-native 1.2.1 → 1.5.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.
Files changed (238) hide show
  1. package/README.md +765 -33
  2. package/android/CMakeLists.txt +4 -3
  3. package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +20 -1
  4. package/android/src/main/jniLibs/arm64-v8a/libcactus.a +0 -0
  5. package/android/src/main/jniLibs/arm64-v8a/libcactus_util.a +0 -0
  6. package/cpp/HybridCactus.cpp +231 -19
  7. package/cpp/HybridCactus.hpp +25 -3
  8. package/cpp/HybridCactusIndex.cpp +325 -0
  9. package/cpp/HybridCactusIndex.hpp +43 -0
  10. package/cpp/HybridCactusUtil.cpp +3 -3
  11. package/cpp/HybridCactusUtil.hpp +2 -1
  12. package/cpp/cactus_ffi.h +107 -2
  13. package/cpp/cactus_util.h +1 -1
  14. package/ios/HybridCactusFileSystem.swift +23 -2
  15. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +2 -0
  16. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +107 -2
  17. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_telemetry.h +656 -0
  18. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/{ffi_utils.h → cactus_utils.h} +145 -18
  19. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +135 -7
  20. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gemma_tools.h +549 -0
  21. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +193 -26
  22. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +54 -195
  23. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +399 -140
  24. package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
  25. package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
  26. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +2 -0
  27. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +107 -2
  28. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_telemetry.h +656 -0
  29. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/{ffi_utils.h → cactus_utils.h} +145 -18
  30. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +135 -7
  31. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/gemma_tools.h +549 -0
  32. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +193 -26
  33. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +54 -195
  34. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +399 -140
  35. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
  36. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/_CodeSignature/CodeResources +1 -1
  37. package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
  38. package/ios/cactus_util.xcframework/Info.plist +4 -4
  39. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +1 -1
  40. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/database.h +27 -0
  41. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
  42. package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
  43. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +1 -1
  44. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/database.h +27 -0
  45. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Info.plist +0 -0
  46. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/_CodeSignature/CodeResources +3 -3
  47. package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
  48. package/lib/module/api/Database.js +12 -95
  49. package/lib/module/api/Database.js.map +1 -1
  50. package/lib/module/classes/CactusIndex.js +45 -0
  51. package/lib/module/classes/CactusIndex.js.map +1 -0
  52. package/lib/module/classes/CactusLM.js +65 -17
  53. package/lib/module/classes/CactusLM.js.map +1 -1
  54. package/lib/module/classes/CactusSTT.js +104 -17
  55. package/lib/module/classes/CactusSTT.js.map +1 -1
  56. package/lib/module/config/CactusConfig.js +2 -0
  57. package/lib/module/config/CactusConfig.js.map +1 -1
  58. package/lib/module/constants/packageVersion.js +1 -1
  59. package/lib/module/hooks/useCactusIndex.js +175 -0
  60. package/lib/module/hooks/useCactusIndex.js.map +1 -0
  61. package/lib/module/hooks/useCactusLM.js +68 -7
  62. package/lib/module/hooks/useCactusLM.js.map +1 -1
  63. package/lib/module/hooks/useCactusSTT.js +102 -6
  64. package/lib/module/hooks/useCactusSTT.js.map +1 -1
  65. package/lib/module/index.js +2 -0
  66. package/lib/module/index.js.map +1 -1
  67. package/lib/module/models.js +336 -0
  68. package/lib/module/models.js.map +1 -0
  69. package/lib/module/native/Cactus.js +61 -13
  70. package/lib/module/native/Cactus.js.map +1 -1
  71. package/lib/module/native/CactusFileSystem.js +3 -0
  72. package/lib/module/native/CactusFileSystem.js.map +1 -1
  73. package/lib/module/native/CactusIndex.js +32 -0
  74. package/lib/module/native/CactusIndex.js.map +1 -0
  75. package/lib/module/native/CactusUtil.js +16 -3
  76. package/lib/module/native/CactusUtil.js.map +1 -1
  77. package/lib/module/native/index.js +1 -0
  78. package/lib/module/native/index.js.map +1 -1
  79. package/lib/module/specs/CactusIndex.nitro.js +4 -0
  80. package/lib/module/specs/CactusIndex.nitro.js.map +1 -0
  81. package/lib/module/telemetry/Telemetry.js +3 -1
  82. package/lib/module/telemetry/Telemetry.js.map +1 -1
  83. package/lib/module/types/CactusIndex.js +2 -0
  84. package/lib/module/types/{CactusModel.js.map → CactusIndex.js.map} +1 -1
  85. package/lib/module/types/CactusLM.js +2 -0
  86. package/lib/module/types/CactusSTT.js +2 -0
  87. package/lib/module/types/common.js +2 -0
  88. package/lib/module/types/{CactusSTTModel.js.map → common.js.map} +1 -1
  89. package/lib/typescript/src/api/Database.d.ts +4 -7
  90. package/lib/typescript/src/api/Database.d.ts.map +1 -1
  91. package/lib/typescript/src/classes/CactusIndex.d.ts +15 -0
  92. package/lib/typescript/src/classes/CactusIndex.d.ts.map +1 -0
  93. package/lib/typescript/src/classes/CactusLM.d.ts +12 -5
  94. package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -1
  95. package/lib/typescript/src/classes/CactusSTT.d.ts +15 -5
  96. package/lib/typescript/src/classes/CactusSTT.d.ts.map +1 -1
  97. package/lib/typescript/src/config/CactusConfig.d.ts +1 -0
  98. package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -1
  99. package/lib/typescript/src/constants/packageVersion.d.ts +1 -1
  100. package/lib/typescript/src/hooks/useCactusIndex.d.ts +14 -0
  101. package/lib/typescript/src/hooks/useCactusIndex.d.ts.map +1 -0
  102. package/lib/typescript/src/hooks/useCactusLM.d.ts +6 -4
  103. package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -1
  104. package/lib/typescript/src/hooks/useCactusSTT.d.ts +13 -5
  105. package/lib/typescript/src/hooks/useCactusSTT.d.ts.map +1 -1
  106. package/lib/typescript/src/index.d.ts +6 -4
  107. package/lib/typescript/src/index.d.ts.map +1 -1
  108. package/lib/typescript/src/models.d.ts +6 -0
  109. package/lib/typescript/src/models.d.ts.map +1 -0
  110. package/lib/typescript/src/native/Cactus.d.ts +10 -3
  111. package/lib/typescript/src/native/Cactus.d.ts.map +1 -1
  112. package/lib/typescript/src/native/CactusFileSystem.d.ts +1 -0
  113. package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -1
  114. package/lib/typescript/src/native/CactusIndex.d.ts +12 -0
  115. package/lib/typescript/src/native/CactusIndex.d.ts.map +1 -0
  116. package/lib/typescript/src/native/CactusUtil.d.ts.map +1 -1
  117. package/lib/typescript/src/native/index.d.ts +1 -0
  118. package/lib/typescript/src/native/index.d.ts.map +1 -1
  119. package/lib/typescript/src/specs/Cactus.nitro.d.ts +9 -2
  120. package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -1
  121. package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts +1 -0
  122. package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts.map +1 -1
  123. package/lib/typescript/src/specs/CactusIndex.nitro.d.ts +24 -0
  124. package/lib/typescript/src/specs/CactusIndex.nitro.d.ts.map +1 -0
  125. package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +1 -1
  126. package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +1 -1
  127. package/lib/typescript/src/types/CactusIndex.d.ts +34 -0
  128. package/lib/typescript/src/types/CactusIndex.d.ts.map +1 -0
  129. package/lib/typescript/src/types/CactusLM.d.ts +19 -0
  130. package/lib/typescript/src/types/CactusLM.d.ts.map +1 -1
  131. package/lib/typescript/src/types/CactusSTT.d.ts +21 -1
  132. package/lib/typescript/src/types/CactusSTT.d.ts.map +1 -1
  133. package/lib/typescript/src/types/common.d.ts +28 -0
  134. package/lib/typescript/src/types/common.d.ts.map +1 -0
  135. package/nitro.json +3 -0
  136. package/nitrogen/generated/android/c++/JDeviceInfo.hpp +1 -1
  137. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +1 -1
  138. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +1 -1
  139. package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +1 -1
  140. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +1 -1
  141. package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +1 -1
  142. package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.cpp +17 -1
  143. package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.hpp +2 -1
  144. package/nitrogen/generated/android/c++/JHybridCactusImageSpec.cpp +1 -1
  145. package/nitrogen/generated/android/c++/JHybridCactusImageSpec.hpp +1 -1
  146. package/nitrogen/generated/android/cactus+autolinking.cmake +2 -1
  147. package/nitrogen/generated/android/cactus+autolinking.gradle +1 -1
  148. package/nitrogen/generated/android/cactusOnLoad.cpp +11 -1
  149. package/nitrogen/generated/android/cactusOnLoad.hpp +1 -1
  150. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +1 -1
  151. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/Func_void_double.kt +1 -1
  152. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +1 -1
  153. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +1 -1
  154. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt +5 -1
  155. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusImageSpec.kt +1 -1
  156. package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/cactusOnLoad.kt +1 -1
  157. package/nitrogen/generated/ios/Cactus+autolinking.rb +1 -1
  158. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +1 -1
  159. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +1 -1
  160. package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +1 -1
  161. package/nitrogen/generated/ios/CactusAutolinking.mm +11 -1
  162. package/nitrogen/generated/ios/CactusAutolinking.swift +1 -1
  163. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +1 -1
  164. package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +1 -1
  165. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +1 -1
  166. package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +1 -1
  167. package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.cpp +1 -1
  168. package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.hpp +9 -1
  169. package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.cpp +1 -1
  170. package/nitrogen/generated/ios/c++/HybridCactusImageSpecSwift.hpp +1 -1
  171. package/nitrogen/generated/ios/swift/DeviceInfo.swift +1 -1
  172. package/nitrogen/generated/ios/swift/Func_void.swift +1 -1
  173. package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +1 -1
  174. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -1
  175. package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -1
  176. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -1
  177. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +1 -1
  178. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +1 -1
  179. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +1 -1
  180. package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +1 -1
  181. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +1 -1
  182. package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +1 -1
  183. package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec.swift +2 -1
  184. package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec_cxx.swift +20 -1
  185. package/nitrogen/generated/ios/swift/HybridCactusImageSpec.swift +1 -1
  186. package/nitrogen/generated/ios/swift/HybridCactusImageSpec_cxx.swift +1 -1
  187. package/nitrogen/generated/shared/c++/CactusIndexGetResult.hpp +84 -0
  188. package/nitrogen/generated/shared/c++/CactusIndexQueryResult.hpp +79 -0
  189. package/nitrogen/generated/shared/c++/DeviceInfo.hpp +1 -1
  190. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +1 -1
  191. package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +1 -1
  192. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +1 -1
  193. package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +1 -1
  194. package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.cpp +2 -1
  195. package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.hpp +2 -1
  196. package/nitrogen/generated/shared/c++/HybridCactusImageSpec.cpp +1 -1
  197. package/nitrogen/generated/shared/c++/HybridCactusImageSpec.hpp +1 -1
  198. package/nitrogen/generated/shared/c++/HybridCactusIndexSpec.cpp +27 -0
  199. package/nitrogen/generated/shared/c++/HybridCactusIndexSpec.hpp +76 -0
  200. package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +8 -1
  201. package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +11 -3
  202. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +1 -1
  203. package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +2 -2
  204. package/package.json +2 -2
  205. package/src/api/Database.ts +14 -135
  206. package/src/classes/CactusIndex.ts +58 -0
  207. package/src/classes/CactusLM.ts +87 -19
  208. package/src/classes/CactusSTT.ts +134 -20
  209. package/src/config/CactusConfig.ts +3 -0
  210. package/src/constants/packageVersion.ts +1 -1
  211. package/src/hooks/useCactusIndex.ts +195 -0
  212. package/src/hooks/useCactusLM.ts +88 -8
  213. package/src/hooks/useCactusSTT.ts +119 -7
  214. package/src/index.tsx +22 -2
  215. package/src/models.ts +344 -0
  216. package/src/native/Cactus.ts +95 -13
  217. package/src/native/CactusFileSystem.ts +4 -0
  218. package/src/native/CactusIndex.ts +54 -0
  219. package/src/native/CactusUtil.ts +19 -3
  220. package/src/native/index.ts +1 -0
  221. package/src/specs/Cactus.nitro.ts +18 -2
  222. package/src/specs/CactusFileSystem.nitro.ts +2 -0
  223. package/src/specs/CactusIndex.nitro.ts +31 -0
  224. package/src/specs/CactusUtil.nitro.ts +1 -1
  225. package/src/telemetry/Telemetry.ts +1 -1
  226. package/src/types/CactusIndex.ts +40 -0
  227. package/src/types/CactusLM.ts +24 -0
  228. package/src/types/CactusSTT.ts +27 -1
  229. package/src/types/common.ts +28 -0
  230. package/android/src/main/jniLibs/arm64-v8a/libcactus_util.so +0 -0
  231. package/lib/module/types/CactusModel.js +0 -2
  232. package/lib/module/types/CactusSTTModel.js +0 -2
  233. package/lib/typescript/src/types/CactusModel.d.ts +0 -13
  234. package/lib/typescript/src/types/CactusModel.d.ts.map +0 -1
  235. package/lib/typescript/src/types/CactusSTTModel.d.ts +0 -8
  236. package/lib/typescript/src/types/CactusSTTModel.d.ts.map +0 -1
  237. package/src/types/CactusModel.ts +0 -15
  238. package/src/types/CactusSTTModel.ts +0 -10
@@ -0,0 +1,79 @@
1
+ ///
2
+ /// CactusIndexQueryResult.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+
26
+
27
+
28
+ #include <vector>
29
+
30
+ namespace margelo::nitro::cactus {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (CactusIndexQueryResult).
34
+ */
35
+ struct CactusIndexQueryResult {
36
+ public:
37
+ std::vector<std::vector<double>> ids SWIFT_PRIVATE;
38
+ std::vector<std::vector<double>> scores SWIFT_PRIVATE;
39
+
40
+ public:
41
+ CactusIndexQueryResult() = default;
42
+ explicit CactusIndexQueryResult(std::vector<std::vector<double>> ids, std::vector<std::vector<double>> scores): ids(ids), scores(scores) {}
43
+ };
44
+
45
+ } // namespace margelo::nitro::cactus
46
+
47
+ namespace margelo::nitro {
48
+
49
+ // C++ CactusIndexQueryResult <> JS CactusIndexQueryResult (object)
50
+ template <>
51
+ struct JSIConverter<margelo::nitro::cactus::CactusIndexQueryResult> final {
52
+ static inline margelo::nitro::cactus::CactusIndexQueryResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
+ jsi::Object obj = arg.asObject(runtime);
54
+ return margelo::nitro::cactus::CactusIndexQueryResult(
55
+ JSIConverter<std::vector<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, "ids")),
56
+ JSIConverter<std::vector<std::vector<double>>>::fromJSI(runtime, obj.getProperty(runtime, "scores"))
57
+ );
58
+ }
59
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::cactus::CactusIndexQueryResult& arg) {
60
+ jsi::Object obj(runtime);
61
+ obj.setProperty(runtime, "ids", JSIConverter<std::vector<std::vector<double>>>::toJSI(runtime, arg.ids));
62
+ obj.setProperty(runtime, "scores", JSIConverter<std::vector<std::vector<double>>>::toJSI(runtime, arg.scores));
63
+ return obj;
64
+ }
65
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
66
+ if (!value.isObject()) {
67
+ return false;
68
+ }
69
+ jsi::Object obj = value.getObject(runtime);
70
+ if (!nitro::isPlainObject(runtime, obj)) {
71
+ return false;
72
+ }
73
+ if (!JSIConverter<std::vector<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, "ids"))) return false;
74
+ if (!JSIConverter<std::vector<std::vector<double>>>::canConvert(runtime, obj.getProperty(runtime, "scores"))) return false;
75
+ return true;
76
+ }
77
+ };
78
+
79
+ } // namespace margelo::nitro
@@ -2,7 +2,7 @@
2
2
  /// DeviceInfo.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusCryptoSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusCryptoSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusCryptoSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusDeviceInfoSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusDeviceInfoSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusDeviceInfoSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusFileSystemSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusFileSystemSpec.hpp"
@@ -23,6 +23,7 @@ namespace margelo::nitro::cactus {
23
23
  prototype.registerHybridMethod("getModelPath", &HybridCactusFileSystemSpec::getModelPath);
24
24
  prototype.registerHybridMethod("downloadModel", &HybridCactusFileSystemSpec::downloadModel);
25
25
  prototype.registerHybridMethod("deleteModel", &HybridCactusFileSystemSpec::deleteModel);
26
+ prototype.registerHybridMethod("getIndexPath", &HybridCactusFileSystemSpec::getIndexPath);
26
27
  });
27
28
  }
28
29
 
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusFileSystemSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -60,6 +60,7 @@ namespace margelo::nitro::cactus {
60
60
  virtual std::shared_ptr<Promise<std::string>> getModelPath(const std::string& model) = 0;
61
61
  virtual std::shared_ptr<Promise<void>> downloadModel(const std::string& model, const std::string& from, const std::optional<std::function<void(double /* progress */)>>& callback) = 0;
62
62
  virtual std::shared_ptr<Promise<void>> deleteModel(const std::string& model) = 0;
63
+ virtual std::shared_ptr<Promise<std::string>> getIndexPath(const std::string& name) = 0;
63
64
 
64
65
  protected:
65
66
  // Hybrid Setup
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusImageSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusImageSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusImageSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// HybridCactusIndexSpec.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "HybridCactusIndexSpec.hpp"
9
+
10
+ namespace margelo::nitro::cactus {
11
+
12
+ void HybridCactusIndexSpec::loadHybridMethods() {
13
+ // load base methods/properties
14
+ HybridObject::loadHybridMethods();
15
+ // load custom methods/properties
16
+ registerHybrids(this, [](Prototype& prototype) {
17
+ prototype.registerHybridMethod("init", &HybridCactusIndexSpec::init);
18
+ prototype.registerHybridMethod("add", &HybridCactusIndexSpec::add);
19
+ prototype.registerHybridMethod("_delete", &HybridCactusIndexSpec::_delete);
20
+ prototype.registerHybridMethod("get", &HybridCactusIndexSpec::get);
21
+ prototype.registerHybridMethod("query", &HybridCactusIndexSpec::query);
22
+ prototype.registerHybridMethod("compact", &HybridCactusIndexSpec::compact);
23
+ prototype.registerHybridMethod("destroy", &HybridCactusIndexSpec::destroy);
24
+ });
25
+ }
26
+
27
+ } // namespace margelo::nitro::cactus
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HybridCactusIndexSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `CactusIndexGetResult` to properly resolve imports.
17
+ namespace margelo::nitro::cactus { struct CactusIndexGetResult; }
18
+ // Forward declaration of `CactusIndexQueryResult` to properly resolve imports.
19
+ namespace margelo::nitro::cactus { struct CactusIndexQueryResult; }
20
+
21
+ #include <NitroModules/Promise.hpp>
22
+ #include <string>
23
+ #include <vector>
24
+ #include <optional>
25
+ #include "CactusIndexGetResult.hpp"
26
+ #include "CactusIndexQueryResult.hpp"
27
+
28
+ namespace margelo::nitro::cactus {
29
+
30
+ using namespace margelo::nitro;
31
+
32
+ /**
33
+ * An abstract base class for `CactusIndex`
34
+ * Inherit this class to create instances of `HybridCactusIndexSpec` in C++.
35
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
36
+ * @example
37
+ * ```cpp
38
+ * class HybridCactusIndex: public HybridCactusIndexSpec {
39
+ * public:
40
+ * HybridCactusIndex(...): HybridObject(TAG) { ... }
41
+ * // ...
42
+ * };
43
+ * ```
44
+ */
45
+ class HybridCactusIndexSpec: public virtual HybridObject {
46
+ public:
47
+ // Constructor
48
+ explicit HybridCactusIndexSpec(): HybridObject(TAG) { }
49
+
50
+ // Destructor
51
+ ~HybridCactusIndexSpec() override = default;
52
+
53
+ public:
54
+ // Properties
55
+
56
+
57
+ public:
58
+ // Methods
59
+ virtual std::shared_ptr<Promise<void>> init(const std::string& indexPath, double embeddingDim) = 0;
60
+ virtual std::shared_ptr<Promise<void>> add(const std::vector<double>& ids, const std::vector<std::string>& documents, const std::vector<std::vector<double>>& embeddings, const std::optional<std::vector<std::string>>& metadatas) = 0;
61
+ virtual std::shared_ptr<Promise<void>> _delete(const std::vector<double>& ids) = 0;
62
+ virtual std::shared_ptr<Promise<CactusIndexGetResult>> get(const std::vector<double>& ids) = 0;
63
+ virtual std::shared_ptr<Promise<CactusIndexQueryResult>> query(const std::vector<std::vector<double>>& embeddings, const std::optional<std::string>& optionsJson) = 0;
64
+ virtual std::shared_ptr<Promise<void>> compact() = 0;
65
+ virtual std::shared_ptr<Promise<void>> destroy() = 0;
66
+
67
+ protected:
68
+ // Hybrid Setup
69
+ void loadHybridMethods() override;
70
+
71
+ protected:
72
+ // Tag for logging
73
+ static constexpr auto TAG = "CactusIndex";
74
+ };
75
+
76
+ } // namespace margelo::nitro::cactus
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusSpec.hpp"
@@ -16,7 +16,14 @@ namespace margelo::nitro::cactus {
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
17
  prototype.registerHybridMethod("init", &HybridCactusSpec::init);
18
18
  prototype.registerHybridMethod("complete", &HybridCactusSpec::complete);
19
+ prototype.registerHybridMethod("tokenize", &HybridCactusSpec::tokenize);
20
+ prototype.registerHybridMethod("scoreWindow", &HybridCactusSpec::scoreWindow);
19
21
  prototype.registerHybridMethod("transcribe", &HybridCactusSpec::transcribe);
22
+ prototype.registerHybridMethod("streamTranscribeInit", &HybridCactusSpec::streamTranscribeInit);
23
+ prototype.registerHybridMethod("streamTranscribeInsert", &HybridCactusSpec::streamTranscribeInsert);
24
+ prototype.registerHybridMethod("streamTranscribeProcess", &HybridCactusSpec::streamTranscribeProcess);
25
+ prototype.registerHybridMethod("streamTranscribeFinalize", &HybridCactusSpec::streamTranscribeFinalize);
26
+ prototype.registerHybridMethod("streamTranscribeDestroy", &HybridCactusSpec::streamTranscribeDestroy);
20
27
  prototype.registerHybridMethod("embed", &HybridCactusSpec::embed);
21
28
  prototype.registerHybridMethod("imageEmbed", &HybridCactusSpec::imageEmbed);
22
29
  prototype.registerHybridMethod("audioEmbed", &HybridCactusSpec::audioEmbed);
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -20,6 +20,7 @@
20
20
  #include <optional>
21
21
  #include <functional>
22
22
  #include <vector>
23
+ #include <variant>
23
24
 
24
25
  namespace margelo::nitro::cactus {
25
26
 
@@ -54,8 +55,15 @@ namespace margelo::nitro::cactus {
54
55
  // Methods
55
56
  virtual std::shared_ptr<Promise<void>> init(const std::string& modelPath, double contextSize, const std::optional<std::string>& corpusDir) = 0;
56
57
  virtual std::shared_ptr<Promise<std::string>> complete(const std::string& messagesJson, double responseBufferSize, const std::optional<std::string>& optionsJson, const std::optional<std::string>& toolsJson, const std::optional<std::function<void(const std::string& /* token */, double /* tokenId */)>>& callback) = 0;
57
- virtual std::shared_ptr<Promise<std::string>> transcribe(const std::string& audioFilePath, const std::string& prompt, double responseBufferSize, const std::optional<std::string>& optionsJson, const std::optional<std::function<void(const std::string& /* token */, double /* tokenId */)>>& callback) = 0;
58
- virtual std::shared_ptr<Promise<std::vector<double>>> embed(const std::string& text, double embeddingBufferSize) = 0;
58
+ virtual std::shared_ptr<Promise<std::vector<double>>> tokenize(const std::string& text) = 0;
59
+ virtual std::shared_ptr<Promise<std::string>> scoreWindow(const std::vector<double>& tokens, double start, double end, double context) = 0;
60
+ virtual std::shared_ptr<Promise<std::string>> transcribe(const std::variant<std::vector<double>, std::string>& audio, const std::string& prompt, double responseBufferSize, const std::optional<std::string>& optionsJson, const std::optional<std::function<void(const std::string& /* token */, double /* tokenId */)>>& callback) = 0;
61
+ virtual std::shared_ptr<Promise<void>> streamTranscribeInit() = 0;
62
+ virtual std::shared_ptr<Promise<void>> streamTranscribeInsert(const std::vector<double>& audio) = 0;
63
+ virtual std::shared_ptr<Promise<std::string>> streamTranscribeProcess(const std::optional<std::string>& optionsJson) = 0;
64
+ virtual std::shared_ptr<Promise<std::string>> streamTranscribeFinalize() = 0;
65
+ virtual std::shared_ptr<Promise<void>> streamTranscribeDestroy() = 0;
66
+ virtual std::shared_ptr<Promise<std::vector<double>>> embed(const std::string& text, double embeddingBufferSize, bool normalize) = 0;
59
67
  virtual std::shared_ptr<Promise<std::vector<double>>> imageEmbed(const std::string& imagePath, double embeddingBufferSize) = 0;
60
68
  virtual std::shared_ptr<Promise<std::vector<double>>> audioEmbed(const std::string& audioPath, double embeddingBufferSize) = 0;
61
69
  virtual std::shared_ptr<Promise<void>> reset() = 0;
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusUtilSpec.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridCactusUtilSpec.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridCactusUtilSpec.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © 2026 Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -51,7 +51,7 @@ namespace margelo::nitro::cactus {
51
51
  public:
52
52
  // Methods
53
53
  virtual std::shared_ptr<Promise<std::string>> registerApp(const std::string& encryptedData) = 0;
54
- virtual std::shared_ptr<Promise<std::optional<std::string>>> getDeviceId() = 0;
54
+ virtual std::shared_ptr<Promise<std::optional<std::string>>> getDeviceId(const std::optional<std::string>& token) = 0;
55
55
  virtual std::shared_ptr<Promise<void>> setAndroidDataDirectory(const std::string& dataDir) = 0;
56
56
 
57
57
  protected:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cactus-react-native",
3
- "version": "1.2.1",
3
+ "version": "1.5.0",
4
4
  "description": "Run AI models locally on mobile devices",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -83,7 +83,7 @@
83
83
  "react": "19.1.0",
84
84
  "react-native": "0.81.1",
85
85
  "react-native-builder-bob": "^0.40.14",
86
- "react-native-nitro-modules": "^0.31.3",
86
+ "react-native-nitro-modules": "^0.31.10",
87
87
  "release-it": "^19.0.4",
88
88
  "turbo": "^2.5.6",
89
89
  "typescript": "^5.9.2"
@@ -1,28 +1,7 @@
1
1
  import { CactusUtil } from '../native';
2
2
  import type { DeviceInfo } from '../specs/CactusDeviceInfo.nitro';
3
3
  import type { LogRecord } from '../telemetry/Telemetry';
4
- import { packageVersion } from '../constants/packageVersion';
5
- import type { CactusModel } from '../types/CactusModel';
6
- import type { CactusSTTModel } from '../types/CactusSTTModel';
7
-
8
- interface CactusModelResponse {
9
- name: string;
10
- slug: string;
11
- quantization: number;
12
- size_mb: number;
13
- download_url: string;
14
- supports_tool_calling: boolean;
15
- supports_vision: boolean;
16
- supports_completion: boolean;
17
- created_at: Date;
18
- }
19
-
20
- interface CactusSTTModelResponse {
21
- slug: string;
22
- download_url: string;
23
- size_mb: number;
24
- created_at: Date;
25
- }
4
+ import { CactusConfig } from '../config/CactusConfig';
26
5
 
27
6
  export class Database {
28
7
  private static readonly url = 'https://vlqqczxwyaodtcdmdmlw.supabase.co';
@@ -47,12 +26,23 @@ export class Database {
47
26
  }
48
27
  }
49
28
 
50
- public static async registerDevice(device_data: DeviceInfo): Promise<string> {
29
+ public static async registerDevice({
30
+ deviceData,
31
+ deviceId,
32
+ }: {
33
+ deviceData?: DeviceInfo;
34
+ deviceId?: string;
35
+ }): Promise<string> {
51
36
  const response = await fetch(
52
37
  `${this.url}/functions/v1/device-registration`,
53
38
  {
54
39
  method: 'POST',
55
- body: JSON.stringify({ device_data }),
40
+ body: JSON.stringify({
41
+ device_data: deviceData,
42
+ device_id: deviceId,
43
+ cactus_pro_key: CactusConfig.cactusProKey,
44
+ }),
45
+ headers: { 'Content-Type': 'application/json' },
56
46
  }
57
47
  );
58
48
 
@@ -62,115 +52,4 @@ export class Database {
62
52
 
63
53
  return await CactusUtil.registerApp(await response.text());
64
54
  }
65
-
66
- public static async getModel(slug: string): Promise<CactusModel> {
67
- const response = await fetch(
68
- `${this.url}/functions/v1/get-models?slug=${slug}&sdk_name=react&sdk_version=${packageVersion}`,
69
- {
70
- headers: { apikey: this.key, Authorization: `Bearer ${this.key}` },
71
- }
72
- );
73
-
74
- if (!response.ok) {
75
- throw new Error('Getting model failed');
76
- }
77
-
78
- const model = (await response.json()) as CactusModelResponse;
79
-
80
- return {
81
- name: model.name,
82
- slug: model.slug,
83
- quantization: model.quantization,
84
- sizeMb: model.size_mb,
85
- downloadUrl: model.download_url,
86
- supportsToolCalling: model.supports_tool_calling,
87
- supportsVision: model.supports_vision,
88
- supportsCompletion: model.supports_completion,
89
- createdAt: model.created_at,
90
- isDownloaded: false,
91
- };
92
- }
93
-
94
- public static async getSTTModel(slug: string): Promise<CactusSTTModel> {
95
- const response = await fetch(
96
- `${this.url}/rest/v1/whisper?slug=eq.${slug}&select=*`,
97
- {
98
- headers: {
99
- 'apikey': this.key,
100
- 'Authorization': `Bearer ${this.key}`,
101
- 'Accept-Profile': 'cactus',
102
- },
103
- }
104
- );
105
-
106
- if (!response.ok) {
107
- throw new Error('Getting STT model failed');
108
- }
109
-
110
- const [model] = (await response.json()) as CactusSTTModelResponse[];
111
-
112
- if (!model) {
113
- throw new Error(`STT model with slug "${slug}" not found`);
114
- }
115
-
116
- return {
117
- slug: model.slug,
118
- downloadUrl: model.download_url,
119
- sizeMb: model.size_mb,
120
- createdAt: model.created_at,
121
- isDownloaded: false,
122
- };
123
- }
124
-
125
- public static async getModels(): Promise<CactusModel[]> {
126
- const response = await fetch(
127
- `${this.url}/functions/v1/get-models?sdk_name=react&sdk_version=${packageVersion}`,
128
- {
129
- headers: { apikey: this.key, Authorization: `Bearer ${this.key}` },
130
- }
131
- );
132
-
133
- if (!response.ok) {
134
- throw new Error('Getting models failed');
135
- }
136
-
137
- const models = (await response.json()) as CactusModelResponse[];
138
-
139
- return models.map((model) => ({
140
- name: model.name,
141
- slug: model.slug,
142
- quantization: model.quantization,
143
- sizeMb: model.size_mb,
144
- downloadUrl: model.download_url,
145
- supportsToolCalling: model.supports_tool_calling,
146
- supportsVision: model.supports_vision,
147
- supportsCompletion: model.supports_completion,
148
- createdAt: model.created_at,
149
- isDownloaded: false,
150
- }));
151
- }
152
-
153
- public static async getSTTModels(): Promise<CactusSTTModel[]> {
154
- const response = await fetch(`${this.url}/rest/v1/whisper?select=*`, {
155
- headers: {
156
- 'apikey': this.key,
157
- 'Authorization': `Bearer ${this.key}`,
158
- 'Accept-Profile': 'cactus',
159
- },
160
- });
161
-
162
- if (!response.ok) {
163
- throw new Error('Getting STT models failed');
164
- }
165
-
166
- const models = (await response.json()) as CactusSTTModelResponse[];
167
-
168
- return models.map((model) => ({
169
- slug: model.slug,
170
- downloadUrl: model.download_url,
171
- sizeMb: model.size_mb,
172
- createdAt: model.created_at,
173
- isDownloaded: false,
174
- }));
175
- }
176
55
  }
@@ -0,0 +1,58 @@
1
+ import { CactusIndex as NativeCactusIndex, CactusFileSystem } from '../native';
2
+ import type {
3
+ CactusIndexAddParams,
4
+ CactusIndexGetParams,
5
+ CactusIndexGetResult,
6
+ CactusIndexQueryParams,
7
+ CactusIndexQueryResult,
8
+ CactusIndexDeleteParams,
9
+ } from '../types/CactusIndex';
10
+
11
+ export class CactusIndex {
12
+ private readonly cactusIndex = new NativeCactusIndex();
13
+
14
+ private readonly name: string;
15
+ private readonly embeddingDim: number;
16
+
17
+ constructor(name: string, embeddingDim: number) {
18
+ this.name = name;
19
+ this.embeddingDim = embeddingDim;
20
+ }
21
+
22
+ public async init(): Promise<void> {
23
+ const indexPath = await CactusFileSystem.getIndexPath(this.name);
24
+ return this.cactusIndex.init(indexPath, this.embeddingDim);
25
+ }
26
+
27
+ public add({
28
+ ids,
29
+ documents,
30
+ embeddings,
31
+ metadatas,
32
+ }: CactusIndexAddParams): Promise<void> {
33
+ return this.cactusIndex.add(ids, documents, embeddings, metadatas);
34
+ }
35
+
36
+ public delete({ ids }: CactusIndexDeleteParams): Promise<void> {
37
+ return this.cactusIndex.delete(ids);
38
+ }
39
+
40
+ public get({ ids }: CactusIndexGetParams): Promise<CactusIndexGetResult> {
41
+ return this.cactusIndex.get(ids);
42
+ }
43
+
44
+ public query({
45
+ embeddings,
46
+ options,
47
+ }: CactusIndexQueryParams): Promise<CactusIndexQueryResult> {
48
+ return this.cactusIndex.query(embeddings, options);
49
+ }
50
+
51
+ public compact(): Promise<void> {
52
+ return this.cactusIndex.compact();
53
+ }
54
+
55
+ public destroy(): Promise<void> {
56
+ return this.cactusIndex.destroy();
57
+ }
58
+ }