react-native-executorch 0.3.2 → 0.4.1

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 (346) hide show
  1. package/README.md +30 -13
  2. package/android/build.gradle +1 -1
  3. package/android/libs/executorch.aar +0 -0
  4. package/android/src/main/java/com/swmansion/rnexecutorch/ETModule.kt +1 -2
  5. package/android/src/main/java/com/swmansion/rnexecutorch/ImageSegmentation.kt +58 -0
  6. package/android/src/main/java/com/swmansion/rnexecutorch/LLM.kt +13 -49
  7. package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt +37 -0
  8. package/android/src/main/java/com/swmansion/rnexecutorch/StyleTransfer.kt +1 -1
  9. package/android/src/main/java/com/swmansion/rnexecutorch/TextEmbeddings.kt +51 -0
  10. package/android/src/main/java/com/swmansion/rnexecutorch/Tokenizer.kt +86 -0
  11. package/android/src/main/java/com/swmansion/rnexecutorch/models/BaseModel.kt +3 -4
  12. package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsModel.kt +48 -0
  13. package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsUtils.kt +37 -0
  14. package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/ClassificationModel.kt +1 -0
  15. package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/Constants.kt +26 -0
  16. package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/ImageSegmentationModel.kt +142 -0
  17. package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/RecognizerUtils.kt +3 -0
  18. package/android/src/main/java/com/swmansion/rnexecutorch/models/{StyleTransferModel.kt → styleTransfer/StyleTransferModel.kt} +2 -1
  19. package/android/src/main/java/com/swmansion/rnexecutorch/utils/ArrayUtils.kt +0 -8
  20. package/android/src/main/java/com/swmansion/rnexecutorch/{models/classification/Utils.kt → utils/Numerical.kt} +1 -1
  21. package/ios/ExecutorchLib.xcframework/Info.plist +4 -4
  22. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
  23. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/HuggingFaceTokenizer.h +14 -0
  24. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Headers/LLaMARunner.h +1 -23
  25. package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
  26. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
  27. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/HuggingFaceTokenizer.h +14 -0
  28. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Headers/LLaMARunner.h +1 -23
  29. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
  30. package/ios/RnExecutorch/Classification.mm +15 -18
  31. package/ios/RnExecutorch/ETModule.mm +6 -5
  32. package/ios/RnExecutorch/ImageSegmentation.h +5 -0
  33. package/ios/RnExecutorch/ImageSegmentation.mm +60 -0
  34. package/ios/RnExecutorch/LLM.mm +12 -53
  35. package/ios/RnExecutorch/OCR.mm +39 -43
  36. package/ios/RnExecutorch/ObjectDetection.mm +20 -20
  37. package/ios/RnExecutorch/SpeechToText.mm +6 -7
  38. package/ios/RnExecutorch/StyleTransfer.mm +16 -19
  39. package/ios/RnExecutorch/TextEmbeddings.h +5 -0
  40. package/ios/RnExecutorch/TextEmbeddings.mm +62 -0
  41. package/ios/RnExecutorch/Tokenizer.h +5 -0
  42. package/ios/RnExecutorch/Tokenizer.mm +83 -0
  43. package/ios/RnExecutorch/VerticalOCR.mm +36 -36
  44. package/ios/RnExecutorch/models/BaseModel.h +2 -5
  45. package/ios/RnExecutorch/models/BaseModel.mm +5 -15
  46. package/ios/RnExecutorch/models/classification/ClassificationModel.mm +2 -3
  47. package/ios/RnExecutorch/models/classification/Constants.mm +0 -1
  48. package/ios/RnExecutorch/models/image_segmentation/Constants.h +4 -0
  49. package/ios/RnExecutorch/models/image_segmentation/Constants.mm +8 -0
  50. package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.h +10 -0
  51. package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.mm +146 -0
  52. package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.mm +1 -2
  53. package/ios/RnExecutorch/models/ocr/Detector.h +0 -2
  54. package/ios/RnExecutorch/models/ocr/Detector.mm +2 -1
  55. package/ios/RnExecutorch/models/ocr/RecognitionHandler.h +5 -4
  56. package/ios/RnExecutorch/models/ocr/RecognitionHandler.mm +9 -26
  57. package/ios/RnExecutorch/models/ocr/Recognizer.mm +1 -2
  58. package/ios/RnExecutorch/models/ocr/VerticalDetector.h +0 -2
  59. package/ios/RnExecutorch/models/ocr/VerticalDetector.mm +2 -1
  60. package/ios/RnExecutorch/models/ocr/utils/OCRUtils.mm +0 -1
  61. package/ios/RnExecutorch/models/stt/Moonshine.mm +1 -6
  62. package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.mm +7 -11
  63. package/ios/RnExecutorch/models/stt/Whisper.mm +0 -5
  64. package/ios/RnExecutorch/models/{StyleTransferModel.h → style_transfer/StyleTransferModel.h} +1 -1
  65. package/ios/RnExecutorch/models/{StyleTransferModel.mm → style_transfer/StyleTransferModel.mm} +2 -3
  66. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.h +15 -0
  67. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.mm +45 -0
  68. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.h +8 -0
  69. package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.mm +49 -0
  70. package/ios/RnExecutorch/utils/Conversions.h +15 -0
  71. package/ios/RnExecutorch/utils/ImageProcessor.h +0 -1
  72. package/ios/RnExecutorch/{models/classification/Utils.h → utils/Numerical.h} +0 -2
  73. package/ios/RnExecutorch/{models/classification/Utils.mm → utils/Numerical.mm} +0 -2
  74. package/ios/RnExecutorch/utils/ObjectDetectionUtils.mm +0 -2
  75. package/ios/RnExecutorch/utils/SFFT.mm +1 -1
  76. package/ios/RnExecutorch/utils/ScalarType.h +0 -2
  77. package/lib/module/Error.js +16 -2
  78. package/lib/module/Error.js.map +1 -1
  79. package/lib/module/constants/{llamaDefaults.js → llmDefaults.js} +7 -3
  80. package/lib/module/constants/llmDefaults.js.map +1 -0
  81. package/lib/module/constants/modelUrls.js +88 -27
  82. package/lib/module/constants/modelUrls.js.map +1 -1
  83. package/lib/module/constants/ocr/models.js +290 -0
  84. package/lib/module/constants/ocr/models.js.map +1 -0
  85. package/lib/module/constants/ocr/symbols.js +137 -2
  86. package/lib/module/constants/ocr/symbols.js.map +1 -1
  87. package/lib/module/constants/sttDefaults.js +50 -25
  88. package/lib/module/constants/sttDefaults.js.map +1 -1
  89. package/lib/module/controllers/LLMController.js +205 -0
  90. package/lib/module/controllers/LLMController.js.map +1 -0
  91. package/lib/module/controllers/OCRController.js +5 -10
  92. package/lib/module/controllers/OCRController.js.map +1 -1
  93. package/lib/module/controllers/SpeechToTextController.js +225 -122
  94. package/lib/module/controllers/SpeechToTextController.js.map +1 -1
  95. package/lib/module/controllers/VerticalOCRController.js +6 -10
  96. package/lib/module/controllers/VerticalOCRController.js.map +1 -1
  97. package/lib/module/hooks/computer_vision/useClassification.js +8 -23
  98. package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
  99. package/lib/module/hooks/computer_vision/useImageSegmentation.js +13 -0
  100. package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -0
  101. package/lib/module/hooks/computer_vision/useOCR.js +11 -6
  102. package/lib/module/hooks/computer_vision/useOCR.js.map +1 -1
  103. package/lib/module/hooks/computer_vision/useObjectDetection.js +8 -23
  104. package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
  105. package/lib/module/hooks/computer_vision/useStyleTransfer.js +8 -23
  106. package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
  107. package/lib/module/hooks/computer_vision/useVerticalOCR.js +10 -7
  108. package/lib/module/hooks/computer_vision/useVerticalOCR.js.map +1 -1
  109. package/lib/module/hooks/general/useExecutorchModule.js +8 -36
  110. package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
  111. package/lib/module/hooks/natural_language_processing/useLLM.js +54 -63
  112. package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
  113. package/lib/module/hooks/natural_language_processing/useSpeechToText.js +15 -11
  114. package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
  115. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +14 -0
  116. package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -0
  117. package/lib/module/hooks/natural_language_processing/useTokenizer.js +54 -0
  118. package/lib/module/hooks/natural_language_processing/useTokenizer.js.map +1 -0
  119. package/lib/module/hooks/useModule.js +18 -62
  120. package/lib/module/hooks/useModule.js.map +1 -1
  121. package/lib/module/index.js +16 -2
  122. package/lib/module/index.js.map +1 -1
  123. package/lib/module/modules/BaseModule.js +9 -10
  124. package/lib/module/modules/BaseModule.js.map +1 -1
  125. package/lib/module/modules/computer_vision/ClassificationModule.js +8 -5
  126. package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
  127. package/lib/module/modules/computer_vision/ImageSegmentationModule.js +28 -0
  128. package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -0
  129. package/lib/module/modules/computer_vision/ObjectDetectionModule.js +8 -5
  130. package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
  131. package/lib/module/modules/computer_vision/StyleTransferModule.js +8 -5
  132. package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
  133. package/lib/module/modules/general/ExecutorchModule.js +8 -5
  134. package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
  135. package/lib/module/modules/natural_language_processing/LLMModule.js +46 -27
  136. package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
  137. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +8 -5
  138. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
  139. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +14 -0
  140. package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -0
  141. package/lib/module/modules/natural_language_processing/TokenizerModule.js +26 -0
  142. package/lib/module/modules/natural_language_processing/TokenizerModule.js.map +1 -0
  143. package/lib/module/native/NativeClassification.js.map +1 -1
  144. package/lib/module/native/NativeImageSegmentation.js +5 -0
  145. package/lib/module/native/NativeImageSegmentation.js.map +1 -0
  146. package/lib/module/native/NativeLLM.js.map +1 -1
  147. package/lib/module/native/NativeTextEmbeddings.js +5 -0
  148. package/lib/module/native/NativeTextEmbeddings.js.map +1 -0
  149. package/lib/module/native/NativeTokenizer.js +5 -0
  150. package/lib/module/native/NativeTokenizer.js.map +1 -0
  151. package/lib/module/native/RnExecutorchModules.js +18 -113
  152. package/lib/module/native/RnExecutorchModules.js.map +1 -1
  153. package/lib/module/types/common.js.map +1 -1
  154. package/lib/module/types/imageSegmentation.js +29 -0
  155. package/lib/module/types/imageSegmentation.js.map +1 -0
  156. package/lib/module/types/llm.js +7 -0
  157. package/lib/module/types/llm.js.map +1 -0
  158. package/lib/module/types/{object_detection.js → objectDetection.js} +1 -1
  159. package/lib/module/types/objectDetection.js.map +1 -0
  160. package/lib/module/types/ocr.js +2 -0
  161. package/lib/module/types/stt.js +82 -0
  162. package/lib/module/types/stt.js.map +1 -0
  163. package/lib/module/utils/ResourceFetcher.js +156 -0
  164. package/lib/module/utils/ResourceFetcher.js.map +1 -0
  165. package/lib/module/utils/llm.js +25 -0
  166. package/lib/module/utils/llm.js.map +1 -0
  167. package/lib/module/utils/stt.js +22 -0
  168. package/lib/module/utils/stt.js.map +1 -0
  169. package/lib/typescript/Error.d.ts +4 -1
  170. package/lib/typescript/Error.d.ts.map +1 -1
  171. package/lib/typescript/constants/{llamaDefaults.d.ts → llmDefaults.d.ts} +5 -5
  172. package/lib/typescript/constants/llmDefaults.d.ts.map +1 -0
  173. package/lib/typescript/constants/modelUrls.d.ts +74 -28
  174. package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
  175. package/lib/typescript/constants/ocr/models.d.ts +285 -0
  176. package/lib/typescript/constants/ocr/models.d.ts.map +1 -0
  177. package/lib/typescript/constants/ocr/symbols.d.ts +73 -1
  178. package/lib/typescript/constants/ocr/symbols.d.ts.map +1 -1
  179. package/lib/typescript/constants/sttDefaults.d.ts +8 -13
  180. package/lib/typescript/constants/sttDefaults.d.ts.map +1 -1
  181. package/lib/typescript/controllers/LLMController.d.ts +46 -0
  182. package/lib/typescript/controllers/LLMController.d.ts.map +1 -0
  183. package/lib/typescript/controllers/OCRController.d.ts.map +1 -1
  184. package/lib/typescript/controllers/SpeechToTextController.d.ts +30 -16
  185. package/lib/typescript/controllers/SpeechToTextController.d.ts.map +1 -1
  186. package/lib/typescript/controllers/VerticalOCRController.d.ts +1 -1
  187. package/lib/typescript/controllers/VerticalOCRController.d.ts.map +1 -1
  188. package/lib/typescript/hooks/computer_vision/useClassification.d.ts +5 -5
  189. package/lib/typescript/hooks/computer_vision/useClassification.d.ts.map +1 -1
  190. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts +37 -0
  191. package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts.map +1 -0
  192. package/lib/typescript/hooks/computer_vision/useOCR.d.ts +2 -1
  193. package/lib/typescript/hooks/computer_vision/useOCR.d.ts.map +1 -1
  194. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts +5 -4
  195. package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts.map +1 -1
  196. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts +4 -2
  197. package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts.map +1 -1
  198. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts +2 -1
  199. package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts.map +1 -1
  200. package/lib/typescript/hooks/general/useExecutorchModule.d.ts +5 -6
  201. package/lib/typescript/hooks/general/useExecutorchModule.d.ts.map +1 -1
  202. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts +6 -6
  203. package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
  204. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +7 -3
  205. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
  206. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts +13 -0
  207. package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts.map +1 -0
  208. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts +16 -0
  209. package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts.map +1 -0
  210. package/lib/typescript/hooks/useModule.d.ts +11 -10
  211. package/lib/typescript/hooks/useModule.d.ts.map +1 -1
  212. package/lib/typescript/index.d.ts +15 -2
  213. package/lib/typescript/index.d.ts.map +1 -1
  214. package/lib/typescript/modules/BaseModule.d.ts +4 -5
  215. package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
  216. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +7 -7
  217. package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
  218. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +32 -0
  219. package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -0
  220. package/lib/typescript/modules/computer_vision/OCRModule.d.ts.map +1 -1
  221. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +6 -5
  222. package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
  223. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +6 -5
  224. package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
  225. package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts.map +1 -1
  226. package/lib/typescript/modules/general/ExecutorchModule.d.ts +4 -3
  227. package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
  228. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +19 -5
  229. package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
  230. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +7 -4
  231. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
  232. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +8 -0
  233. package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -0
  234. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts +12 -0
  235. package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts.map +1 -0
  236. package/lib/typescript/native/NativeClassification.d.ts.map +1 -1
  237. package/lib/typescript/native/NativeImageSegmentation.d.ts +10 -0
  238. package/lib/typescript/native/NativeImageSegmentation.d.ts.map +1 -0
  239. package/lib/typescript/native/NativeLLM.d.ts +3 -4
  240. package/lib/typescript/native/NativeLLM.d.ts.map +1 -1
  241. package/lib/typescript/native/NativeObjectDetection.d.ts +1 -1
  242. package/lib/typescript/native/NativeObjectDetection.d.ts.map +1 -1
  243. package/lib/typescript/native/NativeSpeechToText.d.ts +2 -2
  244. package/lib/typescript/native/NativeSpeechToText.d.ts.map +1 -1
  245. package/lib/typescript/native/NativeTextEmbeddings.d.ts +8 -0
  246. package/lib/typescript/native/NativeTextEmbeddings.d.ts.map +1 -0
  247. package/lib/typescript/native/NativeTokenizer.d.ts +12 -0
  248. package/lib/typescript/native/NativeTokenizer.d.ts.map +1 -0
  249. package/lib/typescript/native/RnExecutorchModules.d.ts +18 -41
  250. package/lib/typescript/native/RnExecutorchModules.d.ts.map +1 -1
  251. package/lib/typescript/types/common.d.ts +1 -26
  252. package/lib/typescript/types/common.d.ts.map +1 -1
  253. package/lib/typescript/types/imageSegmentation.d.ts +25 -0
  254. package/lib/typescript/types/imageSegmentation.d.ts.map +1 -0
  255. package/lib/typescript/types/llm.d.ts +38 -0
  256. package/lib/typescript/types/llm.d.ts.map +1 -0
  257. package/lib/typescript/types/{object_detection.d.ts → objectDetection.d.ts} +1 -1
  258. package/lib/typescript/types/objectDetection.d.ts.map +1 -0
  259. package/lib/typescript/types/ocr.d.ts +2 -1
  260. package/lib/typescript/types/ocr.d.ts.map +1 -1
  261. package/lib/typescript/types/stt.d.ts +91 -0
  262. package/lib/typescript/types/stt.d.ts.map +1 -0
  263. package/lib/typescript/utils/ResourceFetcher.d.ts +17 -0
  264. package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -0
  265. package/lib/typescript/utils/llm.d.ts +3 -0
  266. package/lib/typescript/utils/llm.d.ts.map +1 -0
  267. package/lib/typescript/utils/stt.d.ts +2 -0
  268. package/lib/typescript/utils/stt.d.ts.map +1 -0
  269. package/package.json +12 -48
  270. package/react-native-executorch.podspec +1 -1
  271. package/src/Error.ts +16 -3
  272. package/src/constants/llmDefaults.ts +14 -0
  273. package/src/constants/modelUrls.ts +146 -39
  274. package/src/constants/ocr/models.ts +453 -0
  275. package/src/constants/ocr/symbols.ts +147 -3
  276. package/src/constants/sttDefaults.ts +55 -37
  277. package/src/controllers/LLMController.ts +286 -0
  278. package/src/controllers/OCRController.ts +14 -28
  279. package/src/controllers/SpeechToTextController.ts +318 -180
  280. package/src/controllers/VerticalOCRController.ts +17 -32
  281. package/src/hooks/computer_vision/useClassification.ts +11 -26
  282. package/src/hooks/computer_vision/useImageSegmentation.ts +18 -0
  283. package/src/hooks/computer_vision/useOCR.ts +17 -5
  284. package/src/hooks/computer_vision/useObjectDetection.ts +10 -24
  285. package/src/hooks/computer_vision/useStyleTransfer.ts +9 -25
  286. package/src/hooks/computer_vision/useVerticalOCR.ts +11 -4
  287. package/src/hooks/general/useExecutorchModule.ts +10 -50
  288. package/src/hooks/natural_language_processing/useLLM.ts +80 -97
  289. package/src/hooks/natural_language_processing/useSpeechToText.ts +39 -12
  290. package/src/hooks/natural_language_processing/useTextEmbeddings.ts +18 -0
  291. package/src/hooks/natural_language_processing/useTokenizer.ts +61 -0
  292. package/src/hooks/useModule.ts +32 -92
  293. package/src/index.tsx +16 -2
  294. package/src/modules/BaseModule.ts +16 -26
  295. package/src/modules/computer_vision/ClassificationModule.ts +13 -8
  296. package/src/modules/computer_vision/ImageSegmentationModule.ts +39 -0
  297. package/src/modules/computer_vision/ObjectDetectionModule.ts +13 -8
  298. package/src/modules/computer_vision/StyleTransferModule.ts +13 -8
  299. package/src/modules/general/ExecutorchModule.ts +11 -6
  300. package/src/modules/natural_language_processing/LLMModule.ts +64 -51
  301. package/src/modules/natural_language_processing/SpeechToTextModule.ts +25 -10
  302. package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +18 -0
  303. package/src/modules/natural_language_processing/TokenizerModule.ts +34 -0
  304. package/src/native/NativeClassification.ts +0 -1
  305. package/src/native/NativeImageSegmentation.ts +14 -0
  306. package/src/native/NativeLLM.ts +3 -10
  307. package/src/native/NativeObjectDetection.ts +1 -1
  308. package/src/native/NativeSpeechToText.ts +2 -2
  309. package/src/native/NativeTextEmbeddings.ts +9 -0
  310. package/src/native/NativeTokenizer.ts +13 -0
  311. package/src/native/RnExecutorchModules.ts +54 -234
  312. package/src/types/common.ts +1 -44
  313. package/src/types/imageSegmentation.ts +25 -0
  314. package/src/types/llm.ts +57 -0
  315. package/src/types/ocr.ts +3 -1
  316. package/src/types/stt.ts +93 -0
  317. package/src/utils/ResourceFetcher.ts +196 -0
  318. package/src/utils/llm.ts +34 -0
  319. package/src/utils/stt.ts +28 -0
  320. package/android/src/main/java/com/swmansion/rnexecutorch/utils/llms/ConversationManager.kt +0 -68
  321. package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/_CodeSignature/CodeResources +0 -124
  322. package/ios/RnExecutorch/utils/llms/Constants.h +0 -6
  323. package/ios/RnExecutorch/utils/llms/Constants.mm +0 -23
  324. package/ios/RnExecutorch/utils/llms/ConversationManager.h +0 -26
  325. package/ios/RnExecutorch/utils/llms/ConversationManager.mm +0 -71
  326. package/lib/module/constants/llamaDefaults.js.map +0 -1
  327. package/lib/module/modules/computer_vision/BaseCVModule.js +0 -14
  328. package/lib/module/modules/computer_vision/BaseCVModule.js.map +0 -1
  329. package/lib/module/types/object_detection.js.map +0 -1
  330. package/lib/module/utils/fetchResource.js +0 -93
  331. package/lib/module/utils/fetchResource.js.map +0 -1
  332. package/lib/module/utils/listDownloadedResources.js +0 -13
  333. package/lib/module/utils/listDownloadedResources.js.map +0 -1
  334. package/lib/typescript/constants/llamaDefaults.d.ts.map +0 -1
  335. package/lib/typescript/modules/computer_vision/BaseCVModule.d.ts +0 -9
  336. package/lib/typescript/modules/computer_vision/BaseCVModule.d.ts.map +0 -1
  337. package/lib/typescript/types/object_detection.d.ts.map +0 -1
  338. package/lib/typescript/utils/fetchResource.d.ts +0 -3
  339. package/lib/typescript/utils/fetchResource.d.ts.map +0 -1
  340. package/lib/typescript/utils/listDownloadedResources.d.ts +0 -3
  341. package/lib/typescript/utils/listDownloadedResources.d.ts.map +0 -1
  342. package/src/constants/llamaDefaults.ts +0 -9
  343. package/src/modules/computer_vision/BaseCVModule.ts +0 -22
  344. package/src/utils/fetchResource.ts +0 -106
  345. package/src/utils/listDownloadedResources.ts +0 -12
  346. /package/src/types/{object_detection.ts → objectDetection.ts} +0 -0
@@ -1,11 +1,3 @@
1
- import {
2
- _ClassificationModule,
3
- _StyleTransferModule,
4
- _ObjectDetectionModule,
5
- ETModule,
6
- _ETModule,
7
- } from '../native/RnExecutorchModules';
8
-
9
1
  export const getTypeIdentifier = (input: ETInput): number => {
10
2
  if (input instanceof Int8Array) return 1;
11
3
  if (input instanceof Int32Array) return 3;
@@ -15,19 +7,7 @@ export const getTypeIdentifier = (input: ETInput): number => {
15
7
  return -1;
16
8
  };
17
9
 
18
- export type ResourceSource = string | number;
19
-
20
- export interface Model {
21
- generate: (input: string) => Promise<void>;
22
- response: string;
23
- downloadProgress: number;
24
- error: string | null;
25
- isModelGenerating: boolean;
26
- isGenerating: boolean;
27
- isModelReady: boolean;
28
- isReady: boolean;
29
- interrupt: () => void;
30
- }
10
+ export type ResourceSource = string | number | object;
31
11
 
32
12
  export type ETInput =
33
13
  | Int8Array
@@ -35,26 +15,3 @@ export type ETInput =
35
15
  | BigInt64Array
36
16
  | Float32Array
37
17
  | Float64Array;
38
-
39
- export interface ExecutorchModule {
40
- error: string | null;
41
- isReady: boolean;
42
- isGenerating: boolean;
43
- forward: (
44
- inputs: ETInput[] | ETInput,
45
- shapes: number[][]
46
- ) => ReturnType<_ETModule['forward']>;
47
- loadMethod: (methodName: string) => Promise<void>;
48
- loadForward: () => Promise<void>;
49
- }
50
-
51
- export type Module =
52
- | _ClassificationModule
53
- | _StyleTransferModule
54
- | _ObjectDetectionModule
55
- | typeof ETModule;
56
-
57
- export interface MessageType {
58
- role: 'user' | 'assistant';
59
- content: string;
60
- }
@@ -0,0 +1,25 @@
1
+ /* eslint-disable @cspell/spellchecker */
2
+ export enum DeeplabLabel {
3
+ BACKGROUND,
4
+ AEROPLANE,
5
+ BICYCLE,
6
+ BIRD,
7
+ BOAT,
8
+ BOTTLE,
9
+ BUS,
10
+ CAR,
11
+ CAT,
12
+ CHAIR,
13
+ COW,
14
+ DININGTABLE,
15
+ DOG,
16
+ HORSE,
17
+ MOTORBIKE,
18
+ PERSON,
19
+ POTTEDPLANT,
20
+ SHEEP,
21
+ SOFA,
22
+ TRAIN,
23
+ TVMONITOR,
24
+ ARGMAX, // Additional label not present in the model
25
+ }
@@ -0,0 +1,57 @@
1
+ export interface LLMType {
2
+ messageHistory: Message[];
3
+ response: string;
4
+ isReady: boolean;
5
+ isGenerating: boolean;
6
+ downloadProgress: number;
7
+ error: string | null;
8
+ configure: ({
9
+ chatConfig,
10
+ toolsConfig,
11
+ }: {
12
+ chatConfig?: Partial<ChatConfig>;
13
+ toolsConfig?: ToolsConfig;
14
+ }) => void;
15
+ generate: (messages: Message[], tools?: LLMTool[]) => Promise<void>;
16
+ sendMessage: (message: string) => Promise<void>;
17
+ deleteMessage: (index: number) => void;
18
+ interrupt: () => void;
19
+ }
20
+
21
+ export type MessageRole = 'user' | 'assistant' | 'system';
22
+
23
+ export interface Message {
24
+ role: MessageRole;
25
+ content: string;
26
+ }
27
+
28
+ export interface ToolCall {
29
+ toolName: string;
30
+ arguments: Object;
31
+ }
32
+
33
+ // usually tool is represented with dictionary (Object), but fields depend on the model
34
+ // unfortunately there's no one standard so it's hard to type it better
35
+ export type LLMTool = Object;
36
+
37
+ export interface ChatConfig {
38
+ initialMessageHistory: Message[];
39
+ contextWindowLength: number;
40
+ systemPrompt: string;
41
+ }
42
+
43
+ export interface ToolsConfig {
44
+ tools: LLMTool[];
45
+ executeToolCallback: (call: ToolCall) => Promise<string | null>;
46
+ displayToolCalls?: boolean;
47
+ }
48
+
49
+ export const SPECIAL_TOKENS = [
50
+ 'bos_token',
51
+ 'eos_token',
52
+ 'unk_token',
53
+ 'sep_token',
54
+ 'pad_token',
55
+ 'cls_token',
56
+ 'mask_token',
57
+ ];
package/src/types/ocr.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { symbols } from '../constants/ocr/symbols';
2
+
1
3
  export interface OCRDetection {
2
4
  bbox: OCRBbox[];
3
5
  text: string;
@@ -9,4 +11,4 @@ export interface OCRBbox {
9
11
  y: number;
10
12
  }
11
13
 
12
- export type OCRLanguage = 'en';
14
+ export type OCRLanguage = keyof typeof symbols;
@@ -0,0 +1,93 @@
1
+ export interface ModelConfig {
2
+ sources: {
3
+ encoder: string;
4
+ decoder: string;
5
+ };
6
+ tokenizer: {
7
+ source: string;
8
+ bos: number;
9
+ eos: number;
10
+ };
11
+ isMultilingual: boolean;
12
+ }
13
+
14
+ // Those languages are supported just by whisper multilingual
15
+ export enum SpeechToTextLanguage {
16
+ Afrikaans = 'af',
17
+ Albanian = 'sq',
18
+ Arabic = 'ar',
19
+ Armenian = 'hy',
20
+ Azerbaijani = 'az',
21
+ Basque = 'eu',
22
+ Belarusian = 'be',
23
+ Bengali = 'bn',
24
+ Bosnian = 'bs',
25
+ Bulgarian = 'bg',
26
+ Burmese = 'my',
27
+ Catalan = 'ca',
28
+ Chinese = 'zh',
29
+ Croatian = 'hr',
30
+ Czech = 'cs',
31
+ Danish = 'da',
32
+ Dutch = 'nl',
33
+ Estonian = 'et',
34
+ English = 'en',
35
+ Finnish = 'fi',
36
+ French = 'fr',
37
+ Galician = 'gl',
38
+ Georgian = 'ka',
39
+ German = 'de',
40
+ Greek = 'el',
41
+ Gujarati = 'gu',
42
+ HaitianCreole = 'ht',
43
+ Hebrew = 'he',
44
+ Hindi = 'hi',
45
+ Hungarian = 'hu',
46
+ Icelandic = 'is',
47
+ Indonesian = 'id',
48
+ Italian = 'it',
49
+ Japanese = 'ja',
50
+ Kannada = 'kn',
51
+ Kazakh = 'kk',
52
+ Khmer = 'km',
53
+ Korean = 'ko',
54
+ Lao = 'lo',
55
+ Latvian = 'lv',
56
+ Lithuanian = 'lt',
57
+ Macedonian = 'mk',
58
+ Malagasy = 'mg',
59
+ Malay = 'ms',
60
+ Malayalam = 'ml',
61
+ Maltese = 'mt',
62
+ Marathi = 'mr',
63
+ Nepali = 'ne',
64
+ Norwegian = 'no',
65
+ Persian = 'fa',
66
+ Polish = 'pl',
67
+ Portuguese = 'pt',
68
+ Punjabi = 'pa',
69
+ Romanian = 'ro',
70
+ Russian = 'ru',
71
+ Serbian = 'sr',
72
+ Sinhala = 'si',
73
+ Slovak = 'sk',
74
+ Slovenian = 'sl',
75
+ Spanish = 'es',
76
+ Sundanese = 'su',
77
+ Swahili = 'sw',
78
+ Swedish = 'sv',
79
+ Tagalog = 'tl',
80
+ Tajik = 'tg',
81
+ Tamil = 'ta',
82
+ Telugu = 'te',
83
+ Thai = 'th',
84
+ Turkish = 'tr',
85
+ Ukrainian = 'uk',
86
+ Urdu = 'ur',
87
+ Uzbek = 'uz',
88
+ Vietnamese = 'vi',
89
+ Welsh = 'cy',
90
+ Yiddish = 'yi',
91
+ }
92
+
93
+ export type AvailableModels = 'whisper' | 'moonshine' | 'whisperMultilingual';
@@ -0,0 +1,196 @@
1
+ import {
2
+ cacheDirectory,
3
+ createDownloadResumable,
4
+ getInfoAsync,
5
+ makeDirectoryAsync,
6
+ moveAsync,
7
+ FileSystemSessionType,
8
+ writeAsStringAsync,
9
+ EncodingType,
10
+ deleteAsync,
11
+ readDirectoryAsync,
12
+ } from 'expo-file-system';
13
+ import { Asset } from 'expo-asset';
14
+ import { RNEDirectory } from '../constants/directories';
15
+ import { ResourceSource } from '../types/common';
16
+
17
+ export class ResourceFetcher {
18
+ static async fetch(
19
+ source: ResourceSource,
20
+ callback: (downloadProgress: number) => void = () => {}
21
+ ) {
22
+ if (typeof source === 'object') {
23
+ return this.handleObject(source);
24
+ }
25
+
26
+ const uri =
27
+ typeof source === 'number' ? Asset.fromModule(source).uri : source;
28
+
29
+ // Handle local files
30
+ if (uri.startsWith('file://')) {
31
+ return this.removeFilePrefix(uri);
32
+ }
33
+
34
+ const filename = this.getFilenameFromUri(uri);
35
+ const fileUri = `${RNEDirectory}${filename}`;
36
+
37
+ if (await this.checkFileExists(fileUri)) {
38
+ return this.removeFilePrefix(fileUri);
39
+ }
40
+ await this.createDirectoryIfNoExists();
41
+
42
+ // Handle local asset files in release mode
43
+ if (!uri.includes('://')) {
44
+ const asset = Asset.fromModule(source);
45
+ const fileUriWithType = `${fileUri}.${asset.type}`;
46
+ await asset.downloadAsync();
47
+ if (!asset.localUri) {
48
+ throw new Error(`Asset local URI is not available for ${source}`);
49
+ }
50
+ await moveAsync({ from: asset.localUri, to: fileUriWithType });
51
+ return this.removeFilePrefix(fileUriWithType);
52
+ }
53
+
54
+ // Handle remote file download
55
+ const cacheFileUri = `${cacheDirectory}${filename}`;
56
+ const downloadResumable = createDownloadResumable(
57
+ uri,
58
+ cacheFileUri,
59
+ { sessionType: FileSystemSessionType.BACKGROUND },
60
+ ({ totalBytesWritten, totalBytesExpectedToWrite }) => {
61
+ callback(totalBytesWritten / totalBytesExpectedToWrite);
62
+ }
63
+ );
64
+ const result = await downloadResumable.downloadAsync();
65
+ if (!result || result.status !== 200) {
66
+ throw new Error(`Failed to fetch resource from '${uri}'`);
67
+ }
68
+ await moveAsync({ from: cacheFileUri, to: fileUri });
69
+
70
+ this.triggerHuggingFaceDownloadCounter(uri);
71
+
72
+ return this.removeFilePrefix(fileUri);
73
+ }
74
+
75
+ static async fetchMultipleResources(
76
+ callback: (downloadProgress: number) => void = () => {},
77
+ ...sources: ResourceSource[]
78
+ ) {
79
+ const paths = [];
80
+
81
+ for (let idx = 0; idx < sources.length; idx++) {
82
+ paths.push(
83
+ await this.fetch(
84
+ sources[idx]!,
85
+ this.calculateDownloadProgress(sources.length, idx, callback)
86
+ )
87
+ );
88
+ }
89
+
90
+ return paths;
91
+ }
92
+
93
+ static async deleteMultipleResources(...sources: ResourceSource[]) {
94
+ for (const source of sources) {
95
+ const filename = this.getFilenameFromUri(source as string);
96
+ const fileUri = `${RNEDirectory}${filename}`;
97
+ if (await this.checkFileExists(fileUri)) {
98
+ await deleteAsync(fileUri);
99
+ }
100
+ }
101
+ }
102
+
103
+ private static calculateDownloadProgress(
104
+ numberOfFiles: number,
105
+ currentFileIndex: number,
106
+ setProgress: (downloadProgress: number) => void
107
+ ) {
108
+ return (progress: number) => {
109
+ if (progress === 1 && currentFileIndex === numberOfFiles - 1) {
110
+ setProgress(1);
111
+ return;
112
+ }
113
+ const contributionPerFile = 1 / numberOfFiles;
114
+ const baseProgress = contributionPerFile * currentFileIndex;
115
+ const scaledProgress = progress * contributionPerFile;
116
+ const updatedProgress = baseProgress + scaledProgress;
117
+ setProgress(updatedProgress);
118
+ };
119
+ }
120
+
121
+ static async listDownloadedFiles() {
122
+ const files = await readDirectoryAsync(RNEDirectory);
123
+ return files.map((file) => `${RNEDirectory}${file}`);
124
+ }
125
+
126
+ static async listDownloadedModels() {
127
+ const files = await this.listDownloadedFiles();
128
+ return files.filter((file) => file.endsWith('.pte'));
129
+ }
130
+
131
+ private static async handleObject(source: object) {
132
+ const jsonString = JSON.stringify(source);
133
+ const digest = this.hashObject(jsonString);
134
+ const filename = `${digest}.json`;
135
+ const path = `${RNEDirectory}${filename}`;
136
+
137
+ if (await this.checkFileExists(path)) {
138
+ return this.removeFilePrefix(path);
139
+ }
140
+
141
+ await this.createDirectoryIfNoExists();
142
+ await writeAsStringAsync(path, jsonString, {
143
+ encoding: EncodingType.UTF8,
144
+ });
145
+
146
+ return this.removeFilePrefix(path);
147
+ }
148
+
149
+ private static getFilenameFromUri(uri: string) {
150
+ let cleanUri = uri.replace(/^https?:\/\//, '');
151
+ cleanUri = cleanUri.split('?')?.[0]?.split('#')?.[0] ?? cleanUri;
152
+ return cleanUri.replace(/[^a-zA-Z0-9._-]/g, '_');
153
+ }
154
+
155
+ private static removeFilePrefix(uri: string) {
156
+ return uri.startsWith('file://') ? uri.slice(7) : uri;
157
+ }
158
+
159
+ private static hashObject(jsonString: string) {
160
+ let hash = 0;
161
+ for (let i = 0; i < jsonString.length; i++) {
162
+ // eslint-disable-next-line no-bitwise
163
+ hash = (hash << 5) - hash + jsonString.charCodeAt(i);
164
+ // eslint-disable-next-line no-bitwise
165
+ hash |= 0;
166
+ }
167
+ // eslint-disable-next-line no-bitwise
168
+ return (hash >>> 0).toString();
169
+ }
170
+
171
+ /*
172
+ * Increments the Hugging Face download counter if the URI points to a Software Mansion Hugging Face repo.
173
+ * More information: https://huggingface.co/docs/hub/models-download-stats
174
+ */
175
+ private static triggerHuggingFaceDownloadCounter(uri: string) {
176
+ const url = new URL(uri);
177
+ if (
178
+ url.host === 'huggingface.co' &&
179
+ url.pathname.startsWith('/software-mansion/')
180
+ ) {
181
+ const baseUrl = `${url.protocol}//${url.host}${url.pathname.split('resolve')[0]}`;
182
+ fetch(`${baseUrl}resolve/main/config.json`, { method: 'HEAD' });
183
+ }
184
+ }
185
+
186
+ private static async createDirectoryIfNoExists() {
187
+ if (!(await this.checkFileExists(RNEDirectory))) {
188
+ await makeDirectoryAsync(RNEDirectory, { intermediates: true });
189
+ }
190
+ }
191
+
192
+ private static async checkFileExists(fileUri: string) {
193
+ const fileInfo = await getInfoAsync(fileUri);
194
+ return fileInfo.exists;
195
+ }
196
+ }
@@ -0,0 +1,34 @@
1
+ import { LLMTool, ToolCall } from '../types/llm';
2
+
3
+ export const parseToolCall: (message: string) => ToolCall[] = (
4
+ message: string
5
+ ) => {
6
+ try {
7
+ const unparsedToolCalls = message.match('\\[(.|\\s)*\\]');
8
+ if (!unparsedToolCalls) {
9
+ throw Error('Regex did not match array.');
10
+ }
11
+ const parsedMessage: LLMTool[] = JSON.parse(unparsedToolCalls[0]);
12
+ const results = [];
13
+
14
+ for (const tool of parsedMessage) {
15
+ if (
16
+ 'name' in tool &&
17
+ typeof tool.name === 'string' &&
18
+ 'arguments' in tool &&
19
+ tool.arguments !== null &&
20
+ typeof tool.arguments === 'object'
21
+ ) {
22
+ results.push({
23
+ toolName: tool.name,
24
+ arguments: tool.arguments,
25
+ });
26
+ }
27
+ }
28
+
29
+ return results;
30
+ } catch (e) {
31
+ console.error(e);
32
+ return [];
33
+ }
34
+ };
@@ -0,0 +1,28 @@
1
+ export const longCommonInfPref = (
2
+ seq1: number[],
3
+ seq2: number[],
4
+ hammingDistThreshold: number
5
+ ) => {
6
+ let maxInd = 0;
7
+ let maxLength = 0;
8
+
9
+ for (let i = 0; i < seq1.length; i++) {
10
+ let j = 0;
11
+ let hammingDist = 0;
12
+ while (
13
+ j < seq2.length &&
14
+ i + j < seq1.length &&
15
+ (seq1[i + j] === seq2[j] || hammingDist < hammingDistThreshold)
16
+ ) {
17
+ if (seq1[i + j] !== seq2[j]) {
18
+ hammingDist++;
19
+ }
20
+ j++;
21
+ }
22
+ if (j >= maxLength) {
23
+ maxLength = j;
24
+ maxInd = i;
25
+ }
26
+ }
27
+ return maxInd;
28
+ };
@@ -1,68 +0,0 @@
1
- package com.swmansion.rnexecutorch.utils.llms
2
-
3
- enum class ChatRole {
4
- SYSTEM,
5
- USER,
6
- ASSISTANT,
7
- }
8
-
9
- const val BEGIN_OF_TEXT_TOKEN = "<|begin_of_text|>"
10
- const val END_OF_TEXT_TOKEN = "<|eot_id|>"
11
- const val START_HEADER_ID_TOKEN = "<|start_header_id|>"
12
- const val END_HEADER_ID_TOKEN = "<|end_header_id|>"
13
-
14
- class ConversationManager(
15
- private val numMessagesContextWindow: Int,
16
- systemPrompt: String,
17
- messageHistory: Array<Map<String, String>>,
18
- ) {
19
- private val basePrompt: String
20
- private val messages = ArrayDeque<String>()
21
-
22
- init {
23
- this.basePrompt =
24
- BEGIN_OF_TEXT_TOKEN +
25
- getHeaderTokenFromRole(ChatRole.SYSTEM) +
26
- systemPrompt +
27
- END_OF_TEXT_TOKEN +
28
- getHeaderTokenFromRole(ChatRole.USER)
29
-
30
- messageHistory.forEach { message ->
31
- when (message["role"]) {
32
- "user" -> addResponse(message["content"]!!, ChatRole.USER)
33
- "assistant" -> addResponse(message["content"]!!, ChatRole.ASSISTANT)
34
- }
35
- }
36
- }
37
-
38
- fun addResponse(
39
- text: String,
40
- senderRole: ChatRole,
41
- ) {
42
- if (this.messages.size >= this.numMessagesContextWindow) {
43
- this.messages.removeFirst()
44
- }
45
- val formattedMessage: String =
46
- if (senderRole == ChatRole.ASSISTANT) {
47
- text + getHeaderTokenFromRole(ChatRole.USER)
48
- } else {
49
- text + END_OF_TEXT_TOKEN + getHeaderTokenFromRole(ChatRole.ASSISTANT)
50
- }
51
- this.messages.add(formattedMessage)
52
- }
53
-
54
- fun getConversation(): String {
55
- val prompt = StringBuilder(this.basePrompt)
56
- for (elem in this.messages) {
57
- prompt.append(elem)
58
- }
59
- return prompt.toString()
60
- }
61
-
62
- private fun getHeaderTokenFromRole(role: ChatRole): String =
63
- when (role) {
64
- ChatRole.SYSTEM -> START_HEADER_ID_TOKEN + "system" + END_HEADER_ID_TOKEN
65
- ChatRole.USER -> START_HEADER_ID_TOKEN + "user" + END_HEADER_ID_TOKEN
66
- ChatRole.ASSISTANT -> START_HEADER_ID_TOKEN + "assistant" + END_HEADER_ID_TOKEN
67
- }
68
- }
@@ -1,124 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>files</key>
6
- <dict>
7
- <key>Headers/ETModel.h</key>
8
- <data>
9
- CFAz750OjepOG7MVBPABGfKHNeI=
10
- </data>
11
- <key>Headers/LLaMARunner.h</key>
12
- <data>
13
- SU8Fo2gR+gVVl9IplHgBJBRh1gQ=
14
- </data>
15
- <key>Info.plist</key>
16
- <data>
17
- l3rE2nBARVh++WIyHCfeHXD6Ewo=
18
- </data>
19
- </dict>
20
- <key>files2</key>
21
- <dict>
22
- <key>Headers/ETModel.h</key>
23
- <dict>
24
- <key>hash2</key>
25
- <data>
26
- UXFd6a5OARqV4JnB+Jm4uqmt15aUmnXSOLPQKZTWZCc=
27
- </data>
28
- </dict>
29
- <key>Headers/LLaMARunner.h</key>
30
- <dict>
31
- <key>hash2</key>
32
- <data>
33
- or8gFkCO2QVkQgaeFAaqs/WqGjv8kABL8Rzcdcuexw0=
34
- </data>
35
- </dict>
36
- </dict>
37
- <key>rules</key>
38
- <dict>
39
- <key>^.*</key>
40
- <true/>
41
- <key>^.*\.lproj/</key>
42
- <dict>
43
- <key>optional</key>
44
- <true/>
45
- <key>weight</key>
46
- <real>1000</real>
47
- </dict>
48
- <key>^.*\.lproj/locversion.plist$</key>
49
- <dict>
50
- <key>omit</key>
51
- <true/>
52
- <key>weight</key>
53
- <real>1100</real>
54
- </dict>
55
- <key>^Base\.lproj/</key>
56
- <dict>
57
- <key>weight</key>
58
- <real>1010</real>
59
- </dict>
60
- <key>^version.plist$</key>
61
- <true/>
62
- </dict>
63
- <key>rules2</key>
64
- <dict>
65
- <key>.*\.dSYM($|/)</key>
66
- <dict>
67
- <key>weight</key>
68
- <real>11</real>
69
- </dict>
70
- <key>^(.*/)?\.DS_Store$</key>
71
- <dict>
72
- <key>omit</key>
73
- <true/>
74
- <key>weight</key>
75
- <real>2000</real>
76
- </dict>
77
- <key>^.*</key>
78
- <true/>
79
- <key>^.*\.lproj/</key>
80
- <dict>
81
- <key>optional</key>
82
- <true/>
83
- <key>weight</key>
84
- <real>1000</real>
85
- </dict>
86
- <key>^.*\.lproj/locversion.plist$</key>
87
- <dict>
88
- <key>omit</key>
89
- <true/>
90
- <key>weight</key>
91
- <real>1100</real>
92
- </dict>
93
- <key>^Base\.lproj/</key>
94
- <dict>
95
- <key>weight</key>
96
- <real>1010</real>
97
- </dict>
98
- <key>^Info\.plist$</key>
99
- <dict>
100
- <key>omit</key>
101
- <true/>
102
- <key>weight</key>
103
- <real>20</real>
104
- </dict>
105
- <key>^PkgInfo$</key>
106
- <dict>
107
- <key>omit</key>
108
- <true/>
109
- <key>weight</key>
110
- <real>20</real>
111
- </dict>
112
- <key>^embedded\.provisionprofile$</key>
113
- <dict>
114
- <key>weight</key>
115
- <real>20</real>
116
- </dict>
117
- <key>^version\.plist$</key>
118
- <dict>
119
- <key>weight</key>
120
- <real>20</real>
121
- </dict>
122
- </dict>
123
- </dict>
124
- </plist>
@@ -1,6 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- extern NSString *const END_OF_TEXT_TOKEN_NS;
4
- extern NSString *const BEGIN_OF_TEXT_TOKEN_NS;
5
- extern NSString *const START_HEADER_ID_TOKEN_NS;
6
- extern NSString *const END_HEADER_ID_TOKEN_NS;