react-native-executorch 0.7.0-nightly-b4770df-20260205 → 0.7.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 (296) hide show
  1. package/common/rnexecutorch/ErrorCodes.h +15 -30
  2. package/common/rnexecutorch/host_objects/ModelHostObject.h +5 -0
  3. package/common/rnexecutorch/models/llm/LLM.cpp +7 -0
  4. package/common/rnexecutorch/models/llm/LLM.h +1 -0
  5. package/lib/module/constants/llmDefaults.js +31 -0
  6. package/lib/module/constants/llmDefaults.js.map +1 -1
  7. package/lib/module/constants/modelUrls.js +220 -0
  8. package/lib/module/constants/modelUrls.js.map +1 -1
  9. package/lib/module/constants/ocr/models.js +255 -73
  10. package/lib/module/constants/ocr/models.js.map +1 -1
  11. package/lib/module/constants/ocr/symbols.js +4 -0
  12. package/lib/module/constants/ocr/symbols.js.map +1 -1
  13. package/lib/module/constants/tts/models.js +6 -2
  14. package/lib/module/constants/tts/models.js.map +1 -1
  15. package/lib/module/constants/tts/voices.js +27 -3
  16. package/lib/module/constants/tts/voices.js.map +1 -1
  17. package/lib/module/constants/versions.js +2 -2
  18. package/lib/module/controllers/LLMController.js +9 -0
  19. package/lib/module/controllers/LLMController.js.map +1 -1
  20. package/lib/module/errors/ErrorCodes.js +54 -0
  21. package/lib/module/errors/ErrorCodes.js.map +1 -1
  22. package/lib/module/errors/errorUtils.js +30 -6
  23. package/lib/module/errors/errorUtils.js.map +1 -1
  24. package/lib/module/hooks/computer_vision/useClassification.js +7 -0
  25. package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
  26. package/lib/module/hooks/computer_vision/useImageEmbeddings.js +8 -0
  27. package/lib/module/hooks/computer_vision/useImageEmbeddings.js.map +1 -1
  28. package/lib/module/hooks/computer_vision/useImageSegmentation.js +7 -0
  29. package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -1
  30. package/lib/module/hooks/computer_vision/useOCR.js +7 -0
  31. package/lib/module/hooks/computer_vision/useOCR.js.map +1 -1
  32. package/lib/module/hooks/computer_vision/useObjectDetection.js +7 -0
  33. package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
  34. package/lib/module/hooks/computer_vision/useStyleTransfer.js +7 -0
  35. package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
  36. package/lib/module/hooks/computer_vision/useTextToImage.js +7 -0
  37. package/lib/module/hooks/computer_vision/useTextToImage.js.map +1 -1
  38. package/lib/module/hooks/computer_vision/useVerticalOCR.js +7 -0
  39. package/lib/module/hooks/computer_vision/useVerticalOCR.js.map +1 -1
  40. package/lib/module/hooks/general/useExecutorchModule.js +8 -0
  41. package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
  42. package/lib/module/hooks/natural_language_processing/useLLM.js +11 -3
  43. package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
  44. package/lib/module/hooks/natural_language_processing/useSpeechToText.js +8 -0
  45. package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
  46. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +7 -0
  47. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -1
  48. package/lib/module/hooks/natural_language_processing/useTextToSpeech.js +8 -0
  49. package/lib/module/hooks/natural_language_processing/useTextToSpeech.js.map +1 -1
  50. package/lib/module/hooks/natural_language_processing/useTokenizer.js +7 -0
  51. package/lib/module/hooks/natural_language_processing/useTokenizer.js.map +1 -1
  52. package/lib/module/hooks/natural_language_processing/useVAD.js +7 -0
  53. package/lib/module/hooks/natural_language_processing/useVAD.js.map +1 -1
  54. package/lib/module/hooks/useModule.js +12 -0
  55. package/lib/module/hooks/useModule.js.map +1 -1
  56. package/lib/module/index.js +10 -1
  57. package/lib/module/index.js.map +1 -1
  58. package/lib/module/modules/BaseModule.js +22 -0
  59. package/lib/module/modules/BaseModule.js.map +1 -1
  60. package/lib/module/modules/computer_vision/ClassificationModule.js +20 -0
  61. package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
  62. package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js +19 -0
  63. package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js.map +1 -1
  64. package/lib/module/modules/computer_vision/ImageSegmentationModule.js +22 -0
  65. package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -1
  66. package/lib/module/modules/computer_vision/OCRModule.js +26 -0
  67. package/lib/module/modules/computer_vision/OCRModule.js.map +1 -1
  68. package/lib/module/modules/computer_vision/ObjectDetectionModule.js +22 -0
  69. package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
  70. package/lib/module/modules/computer_vision/StyleTransferModule.js +20 -0
  71. package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
  72. package/lib/module/modules/computer_vision/TextToImageModule.js +33 -0
  73. package/lib/module/modules/computer_vision/TextToImageModule.js.map +1 -1
  74. package/lib/module/modules/computer_vision/VerticalOCRModule.js +27 -0
  75. package/lib/module/modules/computer_vision/VerticalOCRModule.js.map +1 -1
  76. package/lib/module/modules/general/ExecutorchModule.js +21 -0
  77. package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
  78. package/lib/module/modules/natural_language_processing/LLMModule.js +104 -0
  79. package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
  80. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +67 -21
  81. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
  82. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +21 -0
  83. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -1
  84. package/lib/module/modules/natural_language_processing/TextToSpeechModule.js +40 -0
  85. package/lib/module/modules/natural_language_processing/TextToSpeechModule.js.map +1 -1
  86. package/lib/module/modules/natural_language_processing/TokenizerModule.js +54 -2
  87. package/lib/module/modules/natural_language_processing/TokenizerModule.js.map +1 -1
  88. package/lib/module/modules/natural_language_processing/VADModule.js +20 -0
  89. package/lib/module/modules/natural_language_processing/VADModule.js.map +1 -1
  90. package/lib/module/types/classification.js +4 -0
  91. package/lib/module/types/classification.js.map +1 -0
  92. package/lib/module/types/common.js +96 -0
  93. package/lib/module/types/common.js.map +1 -1
  94. package/lib/module/types/executorchModule.js +4 -0
  95. package/lib/module/types/executorchModule.js.map +1 -0
  96. package/lib/module/types/imageEmbeddings.js +4 -0
  97. package/lib/module/types/imageEmbeddings.js.map +1 -0
  98. package/lib/module/types/imageSegmentation.js +22 -1
  99. package/lib/module/types/imageSegmentation.js.map +1 -1
  100. package/lib/module/types/llm.js +80 -2
  101. package/lib/module/types/llm.js.map +1 -1
  102. package/lib/module/types/objectDetection.js +42 -2
  103. package/lib/module/types/objectDetection.js.map +1 -1
  104. package/lib/module/types/styleTransfer.js +4 -0
  105. package/lib/module/types/styleTransfer.js.map +1 -0
  106. package/lib/module/types/textEmbeddings.js +4 -0
  107. package/lib/module/types/textEmbeddings.js.map +1 -0
  108. package/lib/module/types/tokenizer.js +4 -0
  109. package/lib/module/types/tokenizer.js.map +1 -0
  110. package/lib/module/types/tti.js +4 -0
  111. package/lib/module/types/tti.js.map +1 -0
  112. package/lib/module/types/vad.js +2 -0
  113. package/lib/module/utils/ResourceFetcher.js +63 -0
  114. package/lib/module/utils/ResourceFetcher.js.map +1 -1
  115. package/lib/module/utils/llm.js +24 -1
  116. package/lib/module/utils/llm.js.map +1 -1
  117. package/lib/typescript/constants/llmDefaults.d.ts +27 -0
  118. package/lib/typescript/constants/llmDefaults.d.ts.map +1 -1
  119. package/lib/typescript/constants/modelUrls.d.ts +165 -0
  120. package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
  121. package/lib/typescript/constants/ocr/models.d.ts +189 -315
  122. package/lib/typescript/constants/ocr/models.d.ts.map +1 -1
  123. package/lib/typescript/constants/ocr/symbols.d.ts +3 -0
  124. package/lib/typescript/constants/ocr/symbols.d.ts.map +1 -1
  125. package/lib/typescript/constants/tts/models.d.ts +4 -0
  126. package/lib/typescript/constants/tts/models.d.ts.map +1 -1
  127. package/lib/typescript/constants/tts/voices.d.ts +24 -0
  128. package/lib/typescript/constants/tts/voices.d.ts.map +1 -1
  129. package/lib/typescript/constants/versions.d.ts +2 -2
  130. package/lib/typescript/controllers/LLMController.d.ts +2 -0
  131. package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
  132. package/lib/typescript/errors/ErrorCodes.d.ts +54 -0
  133. package/lib/typescript/errors/ErrorCodes.d.ts.map +1 -1
  134. package/lib/typescript/errors/errorUtils.d.ts +9 -0
  135. package/lib/typescript/errors/errorUtils.d.ts.map +1 -1
  136. package/lib/typescript/hooks/computer_vision/useClassification.d.ts +9 -15
  137. package/lib/typescript/hooks/computer_vision/useClassification.d.ts.map +1 -1
  138. package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts +9 -15
  139. package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts.map +1 -1
  140. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts +9 -38
  141. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts.map +1 -1
  142. package/lib/typescript/hooks/computer_vision/useOCR.d.ts +9 -19
  143. package/lib/typescript/hooks/computer_vision/useOCR.d.ts.map +1 -1
  144. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts +9 -15
  145. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts.map +1 -1
  146. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts +9 -15
  147. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts.map +1 -1
  148. package/lib/typescript/hooks/computer_vision/useTextToImage.d.ts +9 -22
  149. package/lib/typescript/hooks/computer_vision/useTextToImage.d.ts.map +1 -1
  150. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts +9 -20
  151. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts.map +1 -1
  152. package/lib/typescript/hooks/general/useExecutorchModule.d.ts +9 -13
  153. package/lib/typescript/hooks/general/useExecutorchModule.d.ts.map +1 -1
  154. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts +9 -10
  155. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
  156. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +9 -19
  157. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
  158. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts +9 -16
  159. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts.map +1 -1
  160. package/lib/typescript/hooks/natural_language_processing/useTextToSpeech.d.ts +9 -15
  161. package/lib/typescript/hooks/natural_language_processing/useTextToSpeech.d.ts.map +1 -1
  162. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts +9 -18
  163. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts.map +1 -1
  164. package/lib/typescript/hooks/natural_language_processing/useVAD.d.ts +9 -15
  165. package/lib/typescript/hooks/natural_language_processing/useVAD.d.ts.map +1 -1
  166. package/lib/typescript/hooks/useModule.d.ts +12 -0
  167. package/lib/typescript/hooks/useModule.d.ts.map +1 -1
  168. package/lib/typescript/index.d.ts +10 -1
  169. package/lib/typescript/index.d.ts.map +1 -1
  170. package/lib/typescript/modules/BaseModule.d.ts +20 -0
  171. package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
  172. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +21 -1
  173. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
  174. package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts +17 -0
  175. package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts.map +1 -1
  176. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +21 -3
  177. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -1
  178. package/lib/typescript/modules/computer_vision/OCRModule.d.ts +25 -2
  179. package/lib/typescript/modules/computer_vision/OCRModule.d.ts.map +1 -1
  180. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +20 -0
  181. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
  182. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +18 -0
  183. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
  184. package/lib/typescript/modules/computer_vision/TextToImageModule.d.ts +29 -0
  185. package/lib/typescript/modules/computer_vision/TextToImageModule.d.ts.map +1 -1
  186. package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts +26 -2
  187. package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts.map +1 -1
  188. package/lib/typescript/modules/general/ExecutorchModule.d.ts +19 -0
  189. package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
  190. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +97 -7
  191. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
  192. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +62 -4
  193. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
  194. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +19 -0
  195. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -1
  196. package/lib/typescript/modules/natural_language_processing/TextToSpeechModule.d.ts +37 -2
  197. package/lib/typescript/modules/natural_language_processing/TextToSpeechModule.d.ts.map +1 -1
  198. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts +47 -2
  199. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts.map +1 -1
  200. package/lib/typescript/modules/natural_language_processing/VADModule.d.ts +18 -0
  201. package/lib/typescript/modules/natural_language_processing/VADModule.d.ts.map +1 -1
  202. package/lib/typescript/types/classification.d.ts +50 -0
  203. package/lib/typescript/types/classification.d.ts.map +1 -0
  204. package/lib/typescript/types/common.d.ts +92 -0
  205. package/lib/typescript/types/common.d.ts.map +1 -1
  206. package/lib/typescript/types/executorchModule.d.ts +45 -0
  207. package/lib/typescript/types/executorchModule.d.ts.map +1 -0
  208. package/lib/typescript/types/imageEmbeddings.d.ts +48 -0
  209. package/lib/typescript/types/imageEmbeddings.d.ts.map +1 -0
  210. package/lib/typescript/types/imageSegmentation.d.ts +55 -0
  211. package/lib/typescript/types/imageSegmentation.d.ts.map +1 -1
  212. package/lib/typescript/types/llm.d.ts +193 -5
  213. package/lib/typescript/types/llm.d.ts.map +1 -1
  214. package/lib/typescript/types/objectDetection.d.ts +71 -2
  215. package/lib/typescript/types/objectDetection.d.ts.map +1 -1
  216. package/lib/typescript/types/ocr.d.ts +97 -2
  217. package/lib/typescript/types/ocr.d.ts.map +1 -1
  218. package/lib/typescript/types/stt.d.ts +114 -0
  219. package/lib/typescript/types/stt.d.ts.map +1 -1
  220. package/lib/typescript/types/styleTransfer.d.ts +48 -0
  221. package/lib/typescript/types/styleTransfer.d.ts.map +1 -0
  222. package/lib/typescript/types/textEmbeddings.d.ts +53 -0
  223. package/lib/typescript/types/textEmbeddings.d.ts.map +1 -0
  224. package/lib/typescript/types/tokenizer.d.ts +75 -0
  225. package/lib/typescript/types/tokenizer.d.ts.map +1 -0
  226. package/lib/typescript/types/tti.d.ts +74 -0
  227. package/lib/typescript/types/tti.d.ts.map +1 -0
  228. package/lib/typescript/types/tts.d.ts +77 -0
  229. package/lib/typescript/types/tts.d.ts.map +1 -1
  230. package/lib/typescript/types/vad.d.ts +53 -0
  231. package/lib/typescript/types/vad.d.ts.map +1 -1
  232. package/lib/typescript/utils/ResourceFetcher.d.ts +55 -0
  233. package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
  234. package/lib/typescript/utils/llm.d.ts +22 -0
  235. package/lib/typescript/utils/llm.d.ts.map +1 -1
  236. package/package.json +1 -1
  237. package/src/constants/llmDefaults.ts +27 -0
  238. package/src/constants/modelUrls.ts +166 -0
  239. package/src/constants/ocr/models.ts +192 -266
  240. package/src/constants/ocr/symbols.ts +3 -0
  241. package/src/constants/tts/models.ts +6 -2
  242. package/src/constants/tts/voices.ts +27 -3
  243. package/src/constants/versions.ts +2 -2
  244. package/src/controllers/LLMController.ts +15 -0
  245. package/src/errors/ErrorCodes.ts +54 -0
  246. package/src/errors/errorUtils.ts +37 -17
  247. package/src/hooks/computer_vision/useClassification.ts +15 -7
  248. package/src/hooks/computer_vision/useImageEmbeddings.ts +15 -7
  249. package/src/hooks/computer_vision/useImageSegmentation.ts +15 -7
  250. package/src/hooks/computer_vision/useOCR.ts +9 -21
  251. package/src/hooks/computer_vision/useObjectDetection.ts +15 -7
  252. package/src/hooks/computer_vision/useStyleTransfer.ts +15 -7
  253. package/src/hooks/computer_vision/useTextToImage.ts +9 -26
  254. package/src/hooks/computer_vision/useVerticalOCR.ts +9 -19
  255. package/src/hooks/general/useExecutorchModule.ts +12 -7
  256. package/src/hooks/natural_language_processing/useLLM.ts +24 -28
  257. package/src/hooks/natural_language_processing/useSpeechToText.ts +13 -5
  258. package/src/hooks/natural_language_processing/useTextEmbeddings.ts +15 -10
  259. package/src/hooks/natural_language_processing/useTextToSpeech.ts +10 -6
  260. package/src/hooks/natural_language_processing/useTokenizer.ts +10 -6
  261. package/src/hooks/natural_language_processing/useVAD.ts +9 -7
  262. package/src/hooks/useModule.ts +15 -0
  263. package/src/index.ts +10 -5
  264. package/src/modules/BaseModule.ts +20 -0
  265. package/src/modules/computer_vision/ClassificationModule.ts +19 -1
  266. package/src/modules/computer_vision/ImageEmbeddingsModule.ts +17 -0
  267. package/src/modules/computer_vision/ImageSegmentationModule.ts +21 -1
  268. package/src/modules/computer_vision/OCRModule.ts +25 -2
  269. package/src/modules/computer_vision/ObjectDetectionModule.ts +20 -0
  270. package/src/modules/computer_vision/StyleTransferModule.ts +18 -0
  271. package/src/modules/computer_vision/TextToImageModule.ts +29 -0
  272. package/src/modules/computer_vision/VerticalOCRModule.ts +26 -2
  273. package/src/modules/general/ExecutorchModule.ts +19 -0
  274. package/src/modules/natural_language_processing/LLMModule.ts +104 -18
  275. package/src/modules/natural_language_processing/SpeechToTextModule.ts +63 -39
  276. package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +19 -0
  277. package/src/modules/natural_language_processing/TextToSpeechModule.ts +43 -2
  278. package/src/modules/natural_language_processing/TokenizerModule.ts +51 -3
  279. package/src/modules/natural_language_processing/VADModule.ts +18 -0
  280. package/src/types/classification.ts +51 -0
  281. package/src/types/common.ts +93 -0
  282. package/src/types/executorchModule.ts +50 -0
  283. package/src/types/imageEmbeddings.ts +51 -0
  284. package/src/types/imageSegmentation.ts +64 -1
  285. package/src/types/llm.ts +208 -11
  286. package/src/types/objectDetection.ts +79 -1
  287. package/src/types/ocr.ts +107 -2
  288. package/src/types/stt.ts +136 -1
  289. package/src/types/styleTransfer.ts +51 -0
  290. package/src/types/textEmbeddings.ts +58 -0
  291. package/src/types/tokenizer.ts +86 -0
  292. package/src/types/tti.ts +87 -0
  293. package/src/types/tts.ts +85 -2
  294. package/src/types/vad.ts +58 -0
  295. package/src/utils/ResourceFetcher.ts +55 -0
  296. package/src/utils/llm.ts +22 -1
@@ -1,30 +1,115 @@
1
+ /**
2
+ * Common types used across the React Native Executorch package.
3
+ */
4
+
5
+ /**
6
+ * Represents a source of a resource, which can be a string (e.g., URL or file path), a number (e.g., resource ID), or an object (e.g., binary data).
7
+ *
8
+ * @category Types
9
+ */
1
10
  export type ResourceSource = string | number | object;
2
11
 
12
+ /**
13
+ * Enum representing the scalar types of tensors.
14
+ *
15
+ * @category Types
16
+ */
3
17
  export enum ScalarType {
18
+ /**
19
+ * Byte type (8-bit unsigned integer).
20
+ */
4
21
  BYTE = 0,
22
+ /**
23
+ * Character type (8-bit signed integer).
24
+ */
5
25
  CHAR = 1,
26
+ /**
27
+ * Short integer type (16-bit signed integer).
28
+ */
6
29
  SHORT = 2,
30
+ /**
31
+ * Integer type (32-bit signed integer).
32
+ */
7
33
  INT = 3,
34
+ /**
35
+ * Long integer type (64-bit signed integer).
36
+ */
8
37
  LONG = 4,
38
+ /**
39
+ * Half-precision floating point type (16-bit).
40
+ */
9
41
  HALF = 5,
42
+ /**
43
+ * Single-precision floating point type (32-bit).
44
+ */
10
45
  FLOAT = 6,
46
+ /**
47
+ * Double-precision floating point type (64-bit).
48
+ */
11
49
  DOUBLE = 7,
50
+ /**
51
+ * Boolean type.
52
+ */
12
53
  BOOL = 11,
54
+ /**
55
+ * Quantized 8-bit signed integer type.
56
+ */
13
57
  QINT8 = 12,
58
+ /**
59
+ * Quantized 8-bit unsigned integer type.
60
+ */
14
61
  QUINT8 = 13,
62
+ /**
63
+ * Quantized 32-bit signed integer type.
64
+ */
15
65
  QINT32 = 14,
66
+ /**
67
+ * Packed Quantized Unsigned 4-bit Integers type (2 number in 1 byte).
68
+ */
16
69
  QUINT4X2 = 16,
70
+ /**
71
+ * Packed Quantized Unsigned 2-bit Integer type (4 numbers in 1 byte).
72
+ */
17
73
  QUINT2X4 = 17,
74
+ /**
75
+ * Raw Bits type.
76
+ */
18
77
  BITS16 = 22,
78
+ /**
79
+ * Quantized 8-bit floating point type: Sign bit, 5 Exponent bits, 2 Mantissa bits.
80
+ */
19
81
  FLOAT8E5M2 = 23,
82
+ /**
83
+ * Quantized 8-bit floating point type: Sign bit, 4 Exponent bits, 3 Mantissa bits.
84
+ */
20
85
  FLOAT8E4M3FN = 24,
86
+ /**
87
+ * Quantized 8-bit floating point type with No Unsigned Zero (NUZ): Sign bit, 5 Exponent bits, 2 Mantissa bits.
88
+ */
21
89
  FLOAT8E5M2FNUZ = 25,
90
+ /**
91
+ * Quantized 8-bit floating point type with No Unsigned Zero (NUZ): Sign bit, 4 Exponent bits, 3 Mantissa bits.
92
+ */
22
93
  FLOAT8E4M3FNUZ = 26,
94
+ /**
95
+ * Unsigned 16-bit integer type.
96
+ */
23
97
  UINT16 = 27,
98
+ /**
99
+ * Unsigned 32-bit integer type.
100
+ */
24
101
  UINT32 = 28,
102
+ /**
103
+ * Unsigned 64-bit integer type.
104
+ */
25
105
  UINT64 = 29,
26
106
  }
27
107
 
108
+ /**
109
+ * Represents the data buffer of a tensor, which can be one of several typed array formats.
110
+ *
111
+ * @category Types
112
+ */
28
113
  export type TensorBuffer =
29
114
  | ArrayBuffer
30
115
  | Float32Array
@@ -38,6 +123,14 @@ export type TensorBuffer =
38
123
  | BigInt64Array
39
124
  | BigUint64Array;
40
125
 
126
+ /**
127
+ * Represents a pointer to a tensor, including its data buffer, size dimensions, and scalar type.
128
+ *
129
+ * @category Types
130
+ * @property {TensorBuffer} dataPtr - The data buffer of the tensor.
131
+ * @property {number[]} sizes - An array representing the size of each dimension of the tensor.
132
+ * @property {ScalarType} scalarType - The scalar type of the tensor, as defined in the `ScalarType` enum.
133
+ */
41
134
  export interface TensorPtr {
42
135
  dataPtr: TensorBuffer;
43
136
  sizes: number[];
@@ -0,0 +1,50 @@
1
+ import { ResourceSource, TensorPtr } from '../types/common';
2
+ import { RnExecutorchError } from '../errors/errorUtils';
3
+
4
+ /**
5
+ * Props for the `useExecutorchModule` hook.
6
+ *
7
+ * @category Types
8
+ * @property {ResourceSource} modelSource - The source of the ExecuTorch model binary.
9
+ * @property {boolean} [preventLoad] - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
10
+ */
11
+ export interface ExecutorchModuleProps {
12
+ modelSource: ResourceSource;
13
+ preventLoad?: boolean;
14
+ }
15
+
16
+ /**
17
+ * Return type for the `useExecutorchModule` hook.
18
+ * Manages the state and core execution methods for a general ExecuTorch model.
19
+ *
20
+ * @category Types
21
+ */
22
+ export interface ExecutorchModuleType {
23
+ /**
24
+ * Contains the error object if the model failed to load, download, or encountered a runtime error.
25
+ */
26
+ error: RnExecutorchError | null;
27
+
28
+ /**
29
+ * Indicates whether the ExecuTorch model binary has successfully loaded into memory and is ready for inference.
30
+ */
31
+ isReady: boolean;
32
+
33
+ /**
34
+ * Indicates whether the model is currently processing a forward pass.
35
+ */
36
+ isGenerating: boolean;
37
+
38
+ /**
39
+ * Represents the download progress of the model binary as a value between 0 and 1.
40
+ */
41
+ downloadProgress: number;
42
+
43
+ /**
44
+ * Executes the model's forward pass with the provided input tensors.
45
+ * @param inputTensor - An array of `TensorPtr` objects representing the input tensors required by the model.
46
+ * @returns A Promise that resolves to an array of output `TensorPtr` objects resulting from the model's inference.
47
+ * @throws {RnExecutorchError} If the model is not loaded or is currently processing another request.
48
+ */
49
+ forward: (inputTensor: TensorPtr[]) => Promise<TensorPtr[]>;
50
+ }
@@ -0,0 +1,51 @@
1
+ import { RnExecutorchError } from '../errors/errorUtils';
2
+ import { ResourceSource } from './common';
3
+
4
+ /**
5
+ * Props for the `useImageEmbeddings` hook.
6
+ *
7
+ * @category Types
8
+ * @property {Object} model - An object containing the model source.
9
+ * @property {ResourceSource} model.modelSource - The source of the image embeddings model binary.
10
+ * @property {boolean} [preventLoad] - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
11
+ */
12
+ export interface ImageEmbeddingsProps {
13
+ model: { modelSource: ResourceSource };
14
+ preventLoad?: boolean;
15
+ }
16
+
17
+ /**
18
+ * Return type for the `useImageEmbeddings` hook.
19
+ * Manages the state and operations for generating image embeddings (feature vectors) used in Computer Vision tasks.
20
+ *
21
+ * @category Types
22
+ */
23
+ export interface ImageEmbeddingsType {
24
+ /**
25
+ * Contains the error object if the model failed to load, download, or encountered a runtime error during embedding generation.
26
+ */
27
+ error: RnExecutorchError | null;
28
+
29
+ /**
30
+ * Indicates whether the image embeddings model is loaded and ready to process images.
31
+ */
32
+ isReady: boolean;
33
+
34
+ /**
35
+ * Indicates whether the model is currently generating embeddings for an image.
36
+ */
37
+ isGenerating: boolean;
38
+
39
+ /**
40
+ * Represents the download progress of the model binary as a value between 0 and 1.
41
+ */
42
+ downloadProgress: number;
43
+
44
+ /**
45
+ * Executes the model's forward pass to generate embeddings (a feature vector) for the provided image.
46
+ * @param imageSource - A string representing the image source (e.g., a file path, URI, or base64 string) to be processed.
47
+ * @returns A Promise that resolves to a `Float32Array` containing the generated embedding vector.
48
+ * @throws {RnExecutorchError} If the model is not loaded or is currently processing another image.
49
+ */
50
+ forward: (imageSource: string) => Promise<Float32Array>;
51
+ }
@@ -1,4 +1,11 @@
1
- /* eslint-disable @cspell/spellchecker */
1
+ import { RnExecutorchError } from '../errors/errorUtils';
2
+ import { ResourceSource } from './common';
3
+
4
+ /**
5
+ * Labels used in the DeepLab image segmentation model.
6
+ *
7
+ * @category Types
8
+ */
2
9
  export enum DeeplabLabel {
3
10
  BACKGROUND,
4
11
  AEROPLANE,
@@ -23,3 +30,59 @@ export enum DeeplabLabel {
23
30
  TVMONITOR,
24
31
  ARGMAX, // Additional label not present in the model
25
32
  }
33
+
34
+ /**
35
+ * Props for the `useImageSegmentation` hook.
36
+ *
37
+ * @property {Object} model - An object containing the model source.
38
+ * @property {ResourceSource} model.modelSource - The source of the image segmentation model binary.
39
+ * @property {boolean} [preventLoad] - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
40
+ *
41
+ * @category Types
42
+ */
43
+ export interface ImageSegmentationProps {
44
+ model: { modelSource: ResourceSource };
45
+ preventLoad?: boolean;
46
+ }
47
+
48
+ /**
49
+ * Return type for the `useImageSegmentation` hook.
50
+ * Manages the state and operations for Computer Vision image segmentation (e.g., DeepLab).
51
+ *
52
+ * @category Types
53
+ */
54
+ export interface ImageSegmentationType {
55
+ /**
56
+ * Contains the error object if the model failed to load, download, or encountered a runtime error during segmentation.
57
+ */
58
+ error: RnExecutorchError | null;
59
+
60
+ /**
61
+ * Indicates whether the segmentation model is loaded and ready to process images.
62
+ */
63
+ isReady: boolean;
64
+
65
+ /**
66
+ * Indicates whether the model is currently processing an image.
67
+ */
68
+ isGenerating: boolean;
69
+
70
+ /**
71
+ * Represents the download progress of the model binary as a value between 0 and 1.
72
+ */
73
+ downloadProgress: number;
74
+
75
+ /**
76
+ * Executes the model's forward pass to perform semantic segmentation on the provided image.
77
+ * @param imageSource - A string representing the image source (e.g., a file path, URI, or base64 string) to be processed.
78
+ * @param classesOfInterest - An optional array of `DeeplabLabel` enums. If provided, the model will only return segmentation masks for these specific classes.
79
+ * @param resize - An optional boolean indicating whether the output segmentation masks should be resized to match the original image dimensions. Defaults to standard model behavior if undefined.
80
+ * @returns A Promise that resolves to an object mapping each detected `DeeplabLabel` to its corresponding segmentation mask (represented as a flattened array of numbers).
81
+ * @throws {RnExecutorchError} If the model is not loaded or is currently processing another image.
82
+ */
83
+ forward: (
84
+ imageSource: string,
85
+ classesOfInterest?: DeeplabLabel[],
86
+ resize?: boolean
87
+ ) => Promise<Partial<Record<DeeplabLabel, number[]>>>;
88
+ }
package/src/types/llm.ts CHANGED
@@ -1,57 +1,249 @@
1
1
  import { RnExecutorchError } from '../errors/errorUtils';
2
+ import { ResourceSource } from './common';
2
3
 
4
+ /**
5
+ * Properties for initializing and configuring a Large Language Model (LLM) instance.
6
+ *
7
+ * @category Types
8
+ */
9
+ export interface LLMProps {
10
+ model: {
11
+ /**
12
+ * `ResourceSource` that specifies the location of the model binary.
13
+ */
14
+ modelSource: ResourceSource;
15
+ /**
16
+ * `ResourceSource` pointing to the JSON file which contains the tokenizer.
17
+ */
18
+ tokenizerSource: ResourceSource;
19
+ /**
20
+ * `ResourceSource` pointing to the JSON file which contains the tokenizer config.
21
+ */
22
+ tokenizerConfigSource?: ResourceSource;
23
+ };
24
+ /**
25
+ * Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
26
+ */
27
+ preventLoad?: boolean;
28
+ }
29
+
30
+ /**
31
+ * React hook for managing a Large Language Model (LLM) instance.
32
+ *
33
+ * @category Types
34
+ */
3
35
  export interface LLMType {
36
+ /**
37
+ * History containing all messages in conversation. This field is updated after model responds to sendMessage.
38
+ */
4
39
  messageHistory: Message[];
40
+
41
+ /**
42
+ * State of the generated response. This field is updated with each token generated by the model.
43
+ */
5
44
  response: string;
45
+
46
+ /**
47
+ * The most recently generated token.
48
+ */
6
49
  token: string;
50
+
51
+ /**
52
+ * Indicates whether the model is ready.
53
+ */
7
54
  isReady: boolean;
55
+
56
+ /**
57
+ * Indicates whether the model is currently generating a response.
58
+ */
8
59
  isGenerating: boolean;
60
+
61
+ /**
62
+ * Represents the download progress as a value between 0 and 1, indicating the extent of the model file retrieval.
63
+ */
9
64
  downloadProgress: number;
65
+
66
+ /**
67
+ * Contains the error message if the model failed to load.
68
+ */
10
69
  error: RnExecutorchError | null;
11
- configure: ({
12
- chatConfig,
13
- toolsConfig,
14
- generationConfig,
15
- }: {
16
- chatConfig?: Partial<ChatConfig>;
17
- toolsConfig?: ToolsConfig;
18
- generationConfig?: GenerationConfig;
19
- }) => void;
70
+
71
+ /**
72
+ * Configures chat and tool calling.
73
+ * See [Configuring the model](https://docs.swmansion.com/react-native-executorch/docs/hooks/natural-language-processing/useLLM#configuring-the-model) for details.
74
+ *
75
+ * @param {LLMConfig} configuration - Configuration object containing `chatConfig`, `toolsConfig`, and `generationConfig`.
76
+ */
77
+ configure: ({ chatConfig, toolsConfig, generationConfig }: LLMConfig) => void;
78
+
79
+ /**
80
+ * Returns the number of tokens generated so far in the current generation.
81
+ *
82
+ * @returns The count of generated tokens.
83
+ */
20
84
  getGeneratedTokenCount: () => number;
85
+ /**
86
+ * Runs model to complete chat passed in `messages` argument. It doesn't manage conversation context.
87
+ *
88
+ * @param messages - Array of messages representing the chat history.
89
+ * @param tools - Optional array of tools that can be used during generation.
90
+ * @returns The generated tokens as `string`.
91
+ */
21
92
  generate: (messages: Message[], tools?: LLMTool[]) => Promise<string>;
93
+ /**
94
+ * Returns the number of total tokens from the previous generation.This is a sum of prompt tokens and generated tokens.
95
+ *
96
+ * @returns The count of prompt and generated tokens.
97
+ */
98
+ getTotalTokenCount: () => number;
99
+ /**
100
+ * Returns the number of prompt tokens in the last message.
101
+ *
102
+ * @returns The count of prompt token.
103
+ */
104
+ getPromptTokenCount: () => number;
105
+
106
+ /**
107
+ * Function to add user message to conversation.
108
+ * After model responds, `messageHistory` will be updated with both user message and model response.
109
+ *
110
+ * @param message - The message string to send.
111
+ * @returns The model's response as a `string`.
112
+ */
22
113
  sendMessage: (message: string) => Promise<string>;
114
+
115
+ /**
116
+ * Deletes all messages starting with message on `index` position. After deletion `messageHistory` will be updated.
117
+ *
118
+ * @param index - The index of the message to delete from history.
119
+ */
23
120
  deleteMessage: (index: number) => void;
121
+
122
+ /**
123
+ * Function to interrupt the current inference.
124
+ */
24
125
  interrupt: () => void;
25
126
  }
26
127
 
128
+ /**
129
+ * Configuration object for initializing and customizing a Large Language Model (LLM) instance.
130
+ *
131
+ * @category Types
132
+ */
133
+ export interface LLMConfig {
134
+ /**
135
+ * Object configuring chat management, contains following properties:
136
+ *
137
+ * `systemPrompt` - Often used to tell the model what is its purpose, for example - "Be a helpful translator".
138
+ *
139
+ * `initialMessageHistory` - An array of `Message` objects that represent the conversation history. This can be used to provide initial context to the model.
140
+ *
141
+ * `contextWindowLength` - The number of messages from the current conversation that the model will use to generate a response. The higher the number, the more context the model will have. Keep in mind that using larger context windows will result in longer inference time and higher memory usage.
142
+ */
143
+ chatConfig?: Partial<ChatConfig>;
144
+
145
+ /**
146
+ * Object configuring options for enabling and managing tool use. **It will only have effect if your model's chat template support it**. Contains following properties:
147
+ *
148
+ * `tools` - List of objects defining tools.
149
+ *
150
+ * `executeToolCallback` - Function that accepts `ToolCall`, executes tool and returns the string to model.
151
+ *
152
+ * `displayToolCalls` - If set to true, JSON tool calls will be displayed in chat. If false, only answers will be displayed.
153
+ */
154
+ toolsConfig?: ToolsConfig;
155
+
156
+ /**
157
+ * Object configuring generation settings.
158
+ *
159
+ * `outputTokenBatchSize` - Soft upper limit on the number of tokens in each token batch (in certain cases there can be more tokens in given batch, i.e. when the batch would end with special emoji join character).
160
+ *
161
+ * `batchTimeInterval` - Upper limit on the time interval between consecutive token batches.
162
+ *
163
+ * `temperature` - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
164
+ *
165
+ * `topp` - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
166
+ */
167
+ generationConfig?: GenerationConfig;
168
+ }
169
+
170
+ /**
171
+ * Roles that a message sender can have.
172
+ *
173
+ * @category Types
174
+ */
27
175
  export type MessageRole = 'user' | 'assistant' | 'system';
28
176
 
177
+ /**
178
+ * Represents a message in the conversation.
179
+ *
180
+ * @category Types
181
+ * @property {MessageRole} role - Role of the message sender of type `MessageRole`.
182
+ * @property {string} content - Content of the message.
183
+ */
29
184
  export interface Message {
30
185
  role: MessageRole;
31
186
  content: string;
32
187
  }
33
188
 
189
+ /**
190
+ * Represents a tool call made by the model.
191
+ *
192
+ * @category Types
193
+ * @property {string} toolName - The name of the tool being called.
194
+ * @property {Object} arguments - The arguments passed to the tool.
195
+ */
34
196
  export interface ToolCall {
35
197
  toolName: string;
36
198
  arguments: Object;
37
199
  }
38
200
 
39
- // usually tool is represented with dictionary (Object), but fields depend on the model
40
- // unfortunately there's no one standard so it's hard to type it better
201
+ /**
202
+ * Represents a tool that can be used by the model.
203
+ * Usually tool is represented with dictionary (Object), but fields depend on the model.
204
+ * Unfortunately there's no one standard so it's hard to type it better.
205
+ *
206
+ * @category Types
207
+ */
41
208
  export type LLMTool = Object;
42
209
 
210
+ /**
211
+ * Object configuring chat management.
212
+ *
213
+ * @category Types
214
+ * @property {Message[]} initialMessageHistory - An array of `Message` objects that represent the conversation history. This can be used to provide initial context to the model.
215
+ * @property {number} contextWindowLength - The number of messages from the current conversation that the model will use to generate a response. The higher the number, the more context the model will have. Keep in mind that using larger context windows will result in longer inference time and higher memory usage.
216
+ * @property {string} systemPrompt - Often used to tell the model what is its purpose, for example - "Be a helpful translator".
217
+ */
43
218
  export interface ChatConfig {
44
219
  initialMessageHistory: Message[];
45
220
  contextWindowLength: number;
46
221
  systemPrompt: string;
47
222
  }
48
223
 
224
+ /**
225
+ * Object configuring options for enabling and managing tool use. **It will only have effect if your model's chat template support it**.
226
+ *
227
+ * @category Types
228
+ * @property {LLMTool[]} tools - List of objects defining tools.
229
+ * @property {(call: ToolCall) => Promise<string | null>} executeToolCallback - Function that accepts `ToolCall`, executes tool and returns the string to model.
230
+ * @property {boolean} [displayToolCalls] - If set to true, JSON tool calls will be displayed in chat. If false, only answers will be displayed.
231
+ */
49
232
  export interface ToolsConfig {
50
233
  tools: LLMTool[];
51
234
  executeToolCallback: (call: ToolCall) => Promise<string | null>;
52
235
  displayToolCalls?: boolean;
53
236
  }
54
237
 
238
+ /**
239
+ * Object configuring generation settings.
240
+ *
241
+ * @category Types
242
+ * @property {number} [temperature] - Scales output logits by the inverse of temperature. Controls the randomness / creativity of text generation.
243
+ * @property {number} [topp] - Only samples from the smallest set of tokens whose cumulative probability exceeds topp.
244
+ * @property {number} [outputTokenBatchSize] - Soft upper limit on the number of tokens in each token batch (in certain cases there can be more tokens in given batch, i.e. when the batch would end with special emoji join character).
245
+ * @property {number} [batchTimeInterval] - Upper limit on the time interval between consecutive token batches.
246
+ */
55
247
  export interface GenerationConfig {
56
248
  temperature?: number;
57
249
  topp?: number;
@@ -59,6 +251,11 @@ export interface GenerationConfig {
59
251
  batchTimeInterval?: number;
60
252
  }
61
253
 
254
+ /**
255
+ * Special tokens used in Large Language Models (LLMs).
256
+ *
257
+ * @category Types
258
+ */
62
259
  export const SPECIAL_TOKENS = {
63
260
  BOS_TOKEN: 'bos_token',
64
261
  EOS_TOKEN: 'eos_token',
@@ -1,3 +1,15 @@
1
+ import { RnExecutorchError } from '../errors/errorUtils';
2
+ import { ResourceSource } from './common';
3
+
4
+ /**
5
+ * Represents a bounding box for a detected object in an image.
6
+ *
7
+ * @category Types
8
+ * @property {number} x1 - The x-coordinate of the bottom-left corner of the bounding box.
9
+ * @property {number} y1 - The y-coordinate of the bottom-left corner of the bounding box.
10
+ * @property {number} x2 - The x-coordinate of the top-right corner of the bounding box.
11
+ * @property {number} y2 - The y-coordinate of the top-right corner of the bounding box.
12
+ */
1
13
  export interface Bbox {
2
14
  x1: number;
3
15
  x2: number;
@@ -5,13 +17,26 @@ export interface Bbox {
5
17
  y2: number;
6
18
  }
7
19
 
20
+ /**
21
+ * Represents a detected object within an image, including its bounding box, label, and confidence score.
22
+ *
23
+ * @category Types
24
+ * @property {Bbox} bbox - The bounding box of the detected object, defined by its top-left (x1, y1) and bottom-right (x2, y2) coordinates.
25
+ * @property {keyof typeof CocoLabel} label - The class label of the detected object, represented as a key from the `CocoLabel` enum.
26
+ * @property {number} score - The confidence score of the detection, typically ranging from 0 to 1.
27
+ */
8
28
  export interface Detection {
9
29
  bbox: Bbox;
10
30
  label: keyof typeof CocoLabel;
11
31
  score: number;
12
32
  }
13
33
 
14
- enum CocoLabel {
34
+ /**
35
+ * COCO dataset class labels used for object detection.
36
+ *
37
+ * @category Types
38
+ */
39
+ export enum CocoLabel {
15
40
  PERSON = 1,
16
41
  BICYCLE = 2,
17
42
  CAR = 3,
@@ -103,3 +128,56 @@ enum CocoLabel {
103
128
  TOOTHBRUSH = 90,
104
129
  HAIR_BRUSH = 91,
105
130
  }
131
+
132
+ /**
133
+ * Props for the `useObjectDetection` hook.
134
+ *
135
+ * @category Types
136
+ * @property {Object} model - An object containing the model source.
137
+ * @property {ResourceSource} model.modelSource - The source of the object detection model binary.
138
+ * @property {boolean} [preventLoad] - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
139
+ */
140
+ export interface ObjectDetectionProps {
141
+ model: { modelSource: ResourceSource };
142
+ preventLoad?: boolean;
143
+ }
144
+
145
+ /**
146
+ * Return type for the `useObjectDetection` hook.
147
+ * Manages the state and operations for Computer Vision object detection tasks.
148
+ *
149
+ * @category Types
150
+ */
151
+ export interface ObjectDetectionType {
152
+ /**
153
+ * Contains the error object if the model failed to load, download, or encountered a runtime error during detection.
154
+ */
155
+ error: RnExecutorchError | null;
156
+
157
+ /**
158
+ * Indicates whether the object detection model is loaded and ready to process images.
159
+ */
160
+ isReady: boolean;
161
+
162
+ /**
163
+ * Indicates whether the model is currently processing an image.
164
+ */
165
+ isGenerating: boolean;
166
+
167
+ /**
168
+ * Represents the download progress of the model binary as a value between 0 and 1.
169
+ */
170
+ downloadProgress: number;
171
+
172
+ /**
173
+ * Executes the model's forward pass to detect objects within the provided image.
174
+ * @param imageSource - A string representing the image source (e.g., a file path, URI, or base64 string) to be processed.
175
+ * @param detectionThreshold - An optional number between 0 and 1 representing the minimum confidence score required for an object to be included in the results. Default is 0.7.
176
+ * @returns A Promise that resolves to an array of `Detection` objects, where each object typically contains bounding box coordinates, a class label, and a confidence score.
177
+ * @throws {RnExecutorchError} If the model is not loaded or is currently processing another image.
178
+ */
179
+ forward: (
180
+ imageSource: string,
181
+ detectionThreshold?: number
182
+ ) => Promise<Detection[]>;
183
+ }