react-native-executorch 0.5.6 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/libs/classes.jar +0 -0
- package/android/src/main/cpp/CMakeLists.txt +23 -14
- package/common/rnexecutorch/RnExecutorchInstaller.cpp +4 -21
- package/common/rnexecutorch/host_objects/ModelHostObject.h +67 -51
- package/common/rnexecutorch/models/llm/LLM.cpp +24 -1
- package/common/rnexecutorch/models/llm/LLM.h +4 -1
- package/common/rnexecutorch/threads/GlobalThreadPool.h +79 -0
- package/common/rnexecutorch/threads/HighPerformanceThreadPool.h +364 -0
- package/common/rnexecutorch/threads/utils/ThreadUtils.h +29 -0
- package/common/runner/runner.cpp +9 -3
- package/common/runner/runner.h +4 -3
- package/common/runner/text_token_generator.h +28 -10
- package/lib/Error.js +53 -0
- package/lib/ThreadPool.d.ts +10 -0
- package/lib/ThreadPool.js +28 -0
- package/lib/common/Logger.d.ts +8 -0
- package/lib/common/Logger.js +19 -0
- package/lib/constants/directories.js +2 -0
- package/lib/constants/llmDefaults.d.ts +6 -0
- package/lib/constants/llmDefaults.js +16 -0
- package/lib/constants/modelUrls.d.ts +223 -0
- package/lib/constants/modelUrls.js +322 -0
- package/lib/constants/ocr/models.d.ts +882 -0
- package/lib/constants/ocr/models.js +182 -0
- package/lib/constants/ocr/symbols.js +139 -0
- package/lib/constants/sttDefaults.d.ts +28 -0
- package/lib/constants/sttDefaults.js +68 -0
- package/lib/controllers/LLMController.d.ts +47 -0
- package/lib/controllers/LLMController.js +213 -0
- package/lib/controllers/OCRController.js +67 -0
- package/lib/controllers/SpeechToTextController.d.ts +56 -0
- package/lib/controllers/SpeechToTextController.js +349 -0
- package/lib/controllers/VerticalOCRController.js +70 -0
- package/lib/hooks/computer_vision/useClassification.d.ts +15 -0
- package/lib/hooks/computer_vision/useClassification.js +7 -0
- package/lib/hooks/computer_vision/useImageEmbeddings.d.ts +15 -0
- package/lib/hooks/computer_vision/useImageEmbeddings.js +7 -0
- package/lib/hooks/computer_vision/useImageSegmentation.d.ts +38 -0
- package/lib/hooks/computer_vision/useImageSegmentation.js +7 -0
- package/lib/hooks/computer_vision/useOCR.d.ts +20 -0
- package/lib/hooks/computer_vision/useOCR.js +41 -0
- package/lib/hooks/computer_vision/useObjectDetection.d.ts +15 -0
- package/lib/hooks/computer_vision/useObjectDetection.js +7 -0
- package/lib/hooks/computer_vision/useStyleTransfer.d.ts +15 -0
- package/lib/hooks/computer_vision/useStyleTransfer.js +7 -0
- package/lib/hooks/computer_vision/useVerticalOCR.d.ts +21 -0
- package/lib/hooks/computer_vision/useVerticalOCR.js +43 -0
- package/lib/hooks/general/useExecutorchModule.d.ts +13 -0
- package/lib/hooks/general/useExecutorchModule.js +7 -0
- package/lib/hooks/natural_language_processing/useLLM.d.ts +10 -0
- package/lib/hooks/natural_language_processing/useLLM.js +78 -0
- package/lib/hooks/natural_language_processing/useSpeechToText.d.ts +27 -0
- package/lib/hooks/natural_language_processing/useSpeechToText.js +49 -0
- package/lib/hooks/natural_language_processing/useTextEmbeddings.d.ts +16 -0
- package/lib/hooks/natural_language_processing/useTextEmbeddings.js +7 -0
- package/lib/hooks/natural_language_processing/useTokenizer.d.ts +17 -0
- package/lib/hooks/natural_language_processing/useTokenizer.js +52 -0
- package/lib/hooks/useModule.js +45 -0
- package/lib/hooks/useNonStaticModule.d.ts +20 -0
- package/lib/hooks/useNonStaticModule.js +49 -0
- package/lib/index.d.ts +48 -0
- package/lib/index.js +58 -0
- package/lib/module/controllers/LLMController.js +21 -2
- package/lib/module/controllers/LLMController.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useLLM.js +6 -2
- package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
- package/lib/module/modules/natural_language_processing/LLMModule.js +7 -2
- package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
- package/lib/module/types/llm.js.map +1 -1
- package/lib/modules/BaseModule.js +25 -0
- package/lib/modules/BaseNonStaticModule.js +14 -0
- package/lib/modules/computer_vision/ClassificationModule.d.ts +8 -0
- package/lib/modules/computer_vision/ClassificationModule.js +17 -0
- package/lib/modules/computer_vision/ImageEmbeddingsModule.d.ts +8 -0
- package/lib/modules/computer_vision/ImageEmbeddingsModule.js +17 -0
- package/lib/modules/computer_vision/ImageSegmentationModule.d.ts +11 -0
- package/lib/modules/computer_vision/ImageSegmentationModule.js +27 -0
- package/lib/modules/computer_vision/OCRModule.d.ts +14 -0
- package/lib/modules/computer_vision/OCRModule.js +17 -0
- package/lib/modules/computer_vision/ObjectDetectionModule.d.ts +9 -0
- package/lib/modules/computer_vision/ObjectDetectionModule.js +17 -0
- package/lib/modules/computer_vision/StyleTransferModule.d.ts +8 -0
- package/lib/modules/computer_vision/StyleTransferModule.js +17 -0
- package/lib/modules/computer_vision/VerticalOCRModule.d.ts +14 -0
- package/lib/modules/computer_vision/VerticalOCRModule.js +19 -0
- package/lib/modules/general/ExecutorchModule.d.ts +7 -0
- package/lib/modules/general/ExecutorchModule.js +14 -0
- package/lib/modules/natural_language_processing/LLMModule.d.ts +28 -0
- package/lib/modules/natural_language_processing/LLMModule.js +45 -0
- package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +24 -0
- package/lib/modules/natural_language_processing/SpeechToTextModule.js +36 -0
- package/lib/modules/natural_language_processing/TextEmbeddingsModule.d.ts +9 -0
- package/lib/modules/natural_language_processing/TextEmbeddingsModule.js +21 -0
- package/lib/modules/natural_language_processing/TokenizerModule.d.ts +12 -0
- package/lib/modules/natural_language_processing/TokenizerModule.js +30 -0
- package/lib/native/NativeETInstaller.js +2 -0
- package/lib/native/NativeOCR.js +2 -0
- package/lib/native/NativeVerticalOCR.js +2 -0
- package/lib/native/RnExecutorchModules.d.ts +7 -0
- package/lib/native/RnExecutorchModules.js +18 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/common.d.ts +32 -0
- package/lib/types/common.js +25 -0
- package/lib/types/imageSegmentation.js +26 -0
- package/lib/types/llm.d.ts +46 -0
- package/lib/types/llm.js +9 -0
- package/lib/types/objectDetection.js +94 -0
- package/lib/types/ocr.js +1 -0
- package/lib/types/stt.d.ts +94 -0
- package/lib/types/stt.js +85 -0
- package/lib/typescript/controllers/LLMController.d.ts +4 -2
- package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +4 -2
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
- package/lib/typescript/types/llm.d.ts +7 -1
- package/lib/typescript/types/llm.d.ts.map +1 -1
- package/lib/utils/ResourceFetcher.d.ts +24 -0
- package/lib/utils/ResourceFetcher.js +305 -0
- package/lib/utils/ResourceFetcherUtils.d.ts +54 -0
- package/lib/utils/ResourceFetcherUtils.js +127 -0
- package/lib/utils/llm.d.ts +6 -0
- package/lib/utils/llm.js +72 -0
- package/lib/utils/stt.js +21 -0
- package/package.json +3 -1
- package/react-native-executorch.podspec +12 -31
- package/src/controllers/LLMController.ts +29 -5
- package/src/hooks/natural_language_processing/useLLM.ts +15 -1
- package/src/modules/natural_language_processing/LLMModule.ts +14 -2
- package/src/types/llm.ts +8 -0
- package/third-party/android/libs/cpuinfo/arm64-v8a/libcpuinfo.so +0 -0
- package/third-party/android/libs/executorch/arm64-v8a/libexecutorch.so +0 -0
- package/third-party/android/libs/executorch/x86_64/libexecutorch.so +0 -0
- package/third-party/android/libs/pthreadpool/arm64-v8a/libpthreadpool.so +0 -0
- package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libsentencepiece.a +0 -0
- package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libtokenizers_c.a +0 -0
- package/third-party/android/libs/tokenizers-cpp/arm64-v8a/libtokenizers_cpp.a +0 -0
- package/third-party/android/libs/tokenizers-cpp/x86_64/libsentencepiece.a +0 -0
- package/third-party/android/libs/tokenizers-cpp/x86_64/libtokenizers_c.a +0 -0
- package/third-party/android/libs/tokenizers-cpp/x86_64/libtokenizers_cpp.a +0 -0
- package/third-party/include/c10/macros/Export.h +2 -86
- package/third-party/include/c10/macros/Macros.h +28 -5
- package/third-party/include/c10/util/BFloat16-inl.h +1 -4
- package/third-party/include/c10/util/BFloat16.h +5 -8
- package/third-party/include/c10/util/Half.h +5 -0
- package/third-party/include/c10/util/bit_cast.h +1 -1
- package/third-party/include/c10/util/complex.h +639 -0
- package/third-party/include/c10/util/complex_math.h +399 -0
- package/third-party/include/c10/util/complex_utils.h +41 -0
- package/third-party/include/c10/util/irange.h +2 -2
- package/third-party/include/c10/util/overflows.h +95 -0
- package/third-party/include/executorch/ExecuTorchError.h +75 -0
- package/third-party/include/executorch/ExecuTorchModule.h +115 -11
- package/third-party/include/executorch/ExecuTorchTensor.h +731 -51
- package/third-party/include/executorch/ExecuTorchValue.h +61 -9
- package/third-party/include/executorch/extension/kernel_util/make_boxed_from_unboxed_functor.h +181 -0
- package/third-party/include/executorch/extension/kernel_util/meta_programming.h +108 -0
- package/third-party/include/executorch/extension/kernel_util/type_list.h +137 -0
- package/third-party/include/executorch/extension/module/bundled_module.h +131 -0
- package/third-party/include/executorch/extension/module/module.h +46 -20
- package/third-party/include/executorch/extension/threadpool/cpuinfo_utils.h +1 -3
- package/third-party/include/executorch/extension/threadpool/threadpool.h +1 -3
- package/third-party/include/executorch/extension/threadpool/threadpool_guard.h +35 -0
- package/third-party/include/executorch/runtime/backend/backend_execution_context.h +3 -3
- package/third-party/include/executorch/runtime/backend/backend_init_context.h +12 -6
- package/third-party/include/executorch/runtime/backend/backend_option_context.h +34 -0
- package/third-party/include/executorch/runtime/backend/interface.h +70 -9
- package/third-party/include/executorch/runtime/backend/options.h +206 -0
- package/third-party/include/executorch/runtime/core/evalue.h +19 -25
- package/third-party/include/executorch/runtime/core/event_tracer.h +32 -17
- package/third-party/include/executorch/runtime/core/event_tracer_hooks.h +23 -14
- package/third-party/include/executorch/runtime/core/exec_aten/exec_aten.h +32 -9
- package/third-party/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +3 -2
- package/third-party/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +43 -75
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_util.h +88 -87
- package/third-party/include/executorch/runtime/core/function_ref.h +100 -0
- package/third-party/include/executorch/runtime/core/named_data_map.h +14 -14
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +2 -86
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +28 -5
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +1 -4
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +5 -8
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +5 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +1 -1
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex.h +639 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex_math.h +399 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/complex_utils.h +41 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +2 -2
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/overflows.h +95 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/torch/headeronly/macros/Export.h +88 -0
- package/third-party/include/executorch/runtime/core/portable_type/complex.h +6 -29
- package/third-party/include/executorch/runtime/core/portable_type/tensor_impl.h +20 -0
- package/third-party/include/executorch/runtime/core/span.h +4 -0
- package/third-party/include/executorch/runtime/core/tag.h +19 -0
- package/third-party/include/executorch/runtime/core/tensor_layout.h +2 -2
- package/third-party/include/executorch/runtime/executor/method.h +15 -3
- package/third-party/include/executorch/runtime/executor/method_meta.h +34 -5
- package/third-party/include/executorch/runtime/executor/program.h +3 -4
- package/third-party/include/executorch/runtime/executor/pte_data_map.h +9 -8
- package/third-party/include/executorch/runtime/executor/tensor_parser.h +14 -13
- package/third-party/include/executorch/runtime/kernel/kernel_runtime_context.h +5 -5
- package/third-party/include/executorch/runtime/kernel/operator_registry.h +21 -19
- package/third-party/include/executorch/runtime/platform/compiler.h +8 -0
- package/third-party/include/executorch/runtime/platform/platform.h +126 -0
- package/third-party/include/headeronly/macros/Export.h +88 -0
- package/third-party/include/tokenizers-cpp/tokenizers_c.h +61 -0
- package/third-party/include/torch/headeronly/macros/Export.h +88 -0
- package/third-party/ios/ExecutorchLib.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/third-party/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
- package/third-party/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/third-party/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
- package/third-party/ios/libs/cpuinfo/libcpuinfo.a +0 -0
- package/third-party/ios/libs/pthreadpool/physical-arm64-release/libpthreadpool.a +0 -0
- package/third-party/ios/libs/pthreadpool/simulator-arm64-debug/libpthreadpool.a +0 -0
- package/ios/libs/executorch/libbackend_coreml_ios.a +0 -0
- package/ios/libs/executorch/libbackend_coreml_simulator.a +0 -0
- package/ios/libs/executorch/libbackend_mps_ios.a +0 -0
- package/ios/libs/executorch/libbackend_mps_simulator.a +0 -0
- package/ios/libs/executorch/libbackend_xnnpack_ios.a +0 -0
- package/ios/libs/executorch/libbackend_xnnpack_simulator.a +0 -0
- package/ios/libs/executorch/libexecutorch_ios.a +0 -0
- package/ios/libs/executorch/libexecutorch_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_custom_ios.a +0 -0
- package/ios/libs/executorch/libkernels_custom_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_optimized_ios.a +0 -0
- package/ios/libs/executorch/libkernels_optimized_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_portable_ios.a +0 -0
- package/ios/libs/executorch/libkernels_portable_simulator.a +0 -0
- package/ios/libs/executorch/libkernels_quantized_ios.a +0 -0
- package/ios/libs/executorch/libkernels_quantized_simulator.a +0 -0
- package/third-party/ios/ios.toolchain.cmake +0 -1122
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libsentencepiece.a +0 -0
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libtokenizers_c.a +0 -0
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/physical-arm64-release/libtokenizers_cpp.a +0 -0
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libsentencepiece.a +0 -0
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_c.a +0 -0
- /package/{ios → third-party/ios}/libs/tokenizers-cpp/simulator-arm64-debug/libtokenizers_cpp.a +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export var ScalarType;
|
|
2
|
+
(function (ScalarType) {
|
|
3
|
+
ScalarType[ScalarType["BYTE"] = 0] = "BYTE";
|
|
4
|
+
ScalarType[ScalarType["CHAR"] = 1] = "CHAR";
|
|
5
|
+
ScalarType[ScalarType["SHORT"] = 2] = "SHORT";
|
|
6
|
+
ScalarType[ScalarType["INT"] = 3] = "INT";
|
|
7
|
+
ScalarType[ScalarType["LONG"] = 4] = "LONG";
|
|
8
|
+
ScalarType[ScalarType["HALF"] = 5] = "HALF";
|
|
9
|
+
ScalarType[ScalarType["FLOAT"] = 6] = "FLOAT";
|
|
10
|
+
ScalarType[ScalarType["DOUBLE"] = 7] = "DOUBLE";
|
|
11
|
+
ScalarType[ScalarType["BOOL"] = 11] = "BOOL";
|
|
12
|
+
ScalarType[ScalarType["QINT8"] = 12] = "QINT8";
|
|
13
|
+
ScalarType[ScalarType["QUINT8"] = 13] = "QUINT8";
|
|
14
|
+
ScalarType[ScalarType["QINT32"] = 14] = "QINT32";
|
|
15
|
+
ScalarType[ScalarType["QUINT4X2"] = 16] = "QUINT4X2";
|
|
16
|
+
ScalarType[ScalarType["QUINT2X4"] = 17] = "QUINT2X4";
|
|
17
|
+
ScalarType[ScalarType["BITS16"] = 22] = "BITS16";
|
|
18
|
+
ScalarType[ScalarType["FLOAT8E5M2"] = 23] = "FLOAT8E5M2";
|
|
19
|
+
ScalarType[ScalarType["FLOAT8E4M3FN"] = 24] = "FLOAT8E4M3FN";
|
|
20
|
+
ScalarType[ScalarType["FLOAT8E5M2FNUZ"] = 25] = "FLOAT8E5M2FNUZ";
|
|
21
|
+
ScalarType[ScalarType["FLOAT8E4M3FNUZ"] = 26] = "FLOAT8E4M3FNUZ";
|
|
22
|
+
ScalarType[ScalarType["UINT16"] = 27] = "UINT16";
|
|
23
|
+
ScalarType[ScalarType["UINT32"] = 28] = "UINT32";
|
|
24
|
+
ScalarType[ScalarType["UINT64"] = 29] = "UINT64";
|
|
25
|
+
})(ScalarType || (ScalarType = {}));
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* eslint-disable @cspell/spellchecker */
|
|
2
|
+
export var DeeplabLabel;
|
|
3
|
+
(function (DeeplabLabel) {
|
|
4
|
+
DeeplabLabel[DeeplabLabel["BACKGROUND"] = 0] = "BACKGROUND";
|
|
5
|
+
DeeplabLabel[DeeplabLabel["AEROPLANE"] = 1] = "AEROPLANE";
|
|
6
|
+
DeeplabLabel[DeeplabLabel["BICYCLE"] = 2] = "BICYCLE";
|
|
7
|
+
DeeplabLabel[DeeplabLabel["BIRD"] = 3] = "BIRD";
|
|
8
|
+
DeeplabLabel[DeeplabLabel["BOAT"] = 4] = "BOAT";
|
|
9
|
+
DeeplabLabel[DeeplabLabel["BOTTLE"] = 5] = "BOTTLE";
|
|
10
|
+
DeeplabLabel[DeeplabLabel["BUS"] = 6] = "BUS";
|
|
11
|
+
DeeplabLabel[DeeplabLabel["CAR"] = 7] = "CAR";
|
|
12
|
+
DeeplabLabel[DeeplabLabel["CAT"] = 8] = "CAT";
|
|
13
|
+
DeeplabLabel[DeeplabLabel["CHAIR"] = 9] = "CHAIR";
|
|
14
|
+
DeeplabLabel[DeeplabLabel["COW"] = 10] = "COW";
|
|
15
|
+
DeeplabLabel[DeeplabLabel["DININGTABLE"] = 11] = "DININGTABLE";
|
|
16
|
+
DeeplabLabel[DeeplabLabel["DOG"] = 12] = "DOG";
|
|
17
|
+
DeeplabLabel[DeeplabLabel["HORSE"] = 13] = "HORSE";
|
|
18
|
+
DeeplabLabel[DeeplabLabel["MOTORBIKE"] = 14] = "MOTORBIKE";
|
|
19
|
+
DeeplabLabel[DeeplabLabel["PERSON"] = 15] = "PERSON";
|
|
20
|
+
DeeplabLabel[DeeplabLabel["POTTEDPLANT"] = 16] = "POTTEDPLANT";
|
|
21
|
+
DeeplabLabel[DeeplabLabel["SHEEP"] = 17] = "SHEEP";
|
|
22
|
+
DeeplabLabel[DeeplabLabel["SOFA"] = 18] = "SOFA";
|
|
23
|
+
DeeplabLabel[DeeplabLabel["TRAIN"] = 19] = "TRAIN";
|
|
24
|
+
DeeplabLabel[DeeplabLabel["TVMONITOR"] = 20] = "TVMONITOR";
|
|
25
|
+
DeeplabLabel[DeeplabLabel["ARGMAX"] = 21] = "ARGMAX";
|
|
26
|
+
})(DeeplabLabel || (DeeplabLabel = {}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface LLMType {
|
|
2
|
+
messageHistory: Message[];
|
|
3
|
+
response: string;
|
|
4
|
+
token: string;
|
|
5
|
+
isReady: boolean;
|
|
6
|
+
isGenerating: boolean;
|
|
7
|
+
downloadProgress: number;
|
|
8
|
+
error: string | null;
|
|
9
|
+
configure: ({ chatConfig, toolsConfig, }: {
|
|
10
|
+
chatConfig?: Partial<ChatConfig>;
|
|
11
|
+
toolsConfig?: ToolsConfig;
|
|
12
|
+
}) => void;
|
|
13
|
+
generate: (messages: Message[], tools?: LLMTool[]) => Promise<void>;
|
|
14
|
+
sendMessage: (message: string) => Promise<void>;
|
|
15
|
+
deleteMessage: (index: number) => void;
|
|
16
|
+
interrupt: () => void;
|
|
17
|
+
}
|
|
18
|
+
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
19
|
+
export interface Message {
|
|
20
|
+
role: MessageRole;
|
|
21
|
+
content: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ToolCall {
|
|
24
|
+
toolName: string;
|
|
25
|
+
arguments: Object;
|
|
26
|
+
}
|
|
27
|
+
export type LLMTool = Object;
|
|
28
|
+
export interface ChatConfig {
|
|
29
|
+
initialMessageHistory: Message[];
|
|
30
|
+
contextWindowLength: number;
|
|
31
|
+
systemPrompt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ToolsConfig {
|
|
34
|
+
tools: LLMTool[];
|
|
35
|
+
executeToolCallback: (call: ToolCall) => Promise<string | null>;
|
|
36
|
+
displayToolCalls?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export declare const SPECIAL_TOKENS: {
|
|
39
|
+
BOS_TOKEN: string;
|
|
40
|
+
EOS_TOKEN: string;
|
|
41
|
+
UNK_TOKEN: string;
|
|
42
|
+
SEP_TOKEN: string;
|
|
43
|
+
PAD_TOKEN: string;
|
|
44
|
+
CLS_TOKEN: string;
|
|
45
|
+
MASK_TOKEN: string;
|
|
46
|
+
};
|
package/lib/types/llm.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
var CocoLabel;
|
|
2
|
+
(function (CocoLabel) {
|
|
3
|
+
CocoLabel[CocoLabel["PERSON"] = 1] = "PERSON";
|
|
4
|
+
CocoLabel[CocoLabel["BICYCLE"] = 2] = "BICYCLE";
|
|
5
|
+
CocoLabel[CocoLabel["CAR"] = 3] = "CAR";
|
|
6
|
+
CocoLabel[CocoLabel["MOTORCYCLE"] = 4] = "MOTORCYCLE";
|
|
7
|
+
CocoLabel[CocoLabel["AIRPLANE"] = 5] = "AIRPLANE";
|
|
8
|
+
CocoLabel[CocoLabel["BUS"] = 6] = "BUS";
|
|
9
|
+
CocoLabel[CocoLabel["TRAIN"] = 7] = "TRAIN";
|
|
10
|
+
CocoLabel[CocoLabel["TRUCK"] = 8] = "TRUCK";
|
|
11
|
+
CocoLabel[CocoLabel["BOAT"] = 9] = "BOAT";
|
|
12
|
+
CocoLabel[CocoLabel["TRAFFIC_LIGHT"] = 10] = "TRAFFIC_LIGHT";
|
|
13
|
+
CocoLabel[CocoLabel["FIRE_HYDRANT"] = 11] = "FIRE_HYDRANT";
|
|
14
|
+
CocoLabel[CocoLabel["STREET_SIGN"] = 12] = "STREET_SIGN";
|
|
15
|
+
CocoLabel[CocoLabel["STOP_SIGN"] = 13] = "STOP_SIGN";
|
|
16
|
+
CocoLabel[CocoLabel["PARKING"] = 14] = "PARKING";
|
|
17
|
+
CocoLabel[CocoLabel["BENCH"] = 15] = "BENCH";
|
|
18
|
+
CocoLabel[CocoLabel["BIRD"] = 16] = "BIRD";
|
|
19
|
+
CocoLabel[CocoLabel["CAT"] = 17] = "CAT";
|
|
20
|
+
CocoLabel[CocoLabel["DOG"] = 18] = "DOG";
|
|
21
|
+
CocoLabel[CocoLabel["HORSE"] = 19] = "HORSE";
|
|
22
|
+
CocoLabel[CocoLabel["SHEEP"] = 20] = "SHEEP";
|
|
23
|
+
CocoLabel[CocoLabel["COW"] = 21] = "COW";
|
|
24
|
+
CocoLabel[CocoLabel["ELEPHANT"] = 22] = "ELEPHANT";
|
|
25
|
+
CocoLabel[CocoLabel["BEAR"] = 23] = "BEAR";
|
|
26
|
+
CocoLabel[CocoLabel["ZEBRA"] = 24] = "ZEBRA";
|
|
27
|
+
CocoLabel[CocoLabel["GIRAFFE"] = 25] = "GIRAFFE";
|
|
28
|
+
CocoLabel[CocoLabel["HAT"] = 26] = "HAT";
|
|
29
|
+
CocoLabel[CocoLabel["BACKPACK"] = 27] = "BACKPACK";
|
|
30
|
+
CocoLabel[CocoLabel["UMBRELLA"] = 28] = "UMBRELLA";
|
|
31
|
+
CocoLabel[CocoLabel["SHOE"] = 29] = "SHOE";
|
|
32
|
+
CocoLabel[CocoLabel["EYE"] = 30] = "EYE";
|
|
33
|
+
CocoLabel[CocoLabel["HANDBAG"] = 31] = "HANDBAG";
|
|
34
|
+
CocoLabel[CocoLabel["TIE"] = 32] = "TIE";
|
|
35
|
+
CocoLabel[CocoLabel["SUITCASE"] = 33] = "SUITCASE";
|
|
36
|
+
CocoLabel[CocoLabel["FRISBEE"] = 34] = "FRISBEE";
|
|
37
|
+
CocoLabel[CocoLabel["SKIS"] = 35] = "SKIS";
|
|
38
|
+
CocoLabel[CocoLabel["SNOWBOARD"] = 36] = "SNOWBOARD";
|
|
39
|
+
CocoLabel[CocoLabel["SPORTS"] = 37] = "SPORTS";
|
|
40
|
+
CocoLabel[CocoLabel["KITE"] = 38] = "KITE";
|
|
41
|
+
CocoLabel[CocoLabel["BASEBALL"] = 39] = "BASEBALL";
|
|
42
|
+
CocoLabel[CocoLabel["SKATEBOARD"] = 41] = "SKATEBOARD";
|
|
43
|
+
CocoLabel[CocoLabel["SURFBOARD"] = 42] = "SURFBOARD";
|
|
44
|
+
CocoLabel[CocoLabel["TENNIS_RACKET"] = 43] = "TENNIS_RACKET";
|
|
45
|
+
CocoLabel[CocoLabel["BOTTLE"] = 44] = "BOTTLE";
|
|
46
|
+
CocoLabel[CocoLabel["PLATE"] = 45] = "PLATE";
|
|
47
|
+
CocoLabel[CocoLabel["WINE_GLASS"] = 46] = "WINE_GLASS";
|
|
48
|
+
CocoLabel[CocoLabel["CUP"] = 47] = "CUP";
|
|
49
|
+
CocoLabel[CocoLabel["FORK"] = 48] = "FORK";
|
|
50
|
+
CocoLabel[CocoLabel["KNIFE"] = 49] = "KNIFE";
|
|
51
|
+
CocoLabel[CocoLabel["SPOON"] = 50] = "SPOON";
|
|
52
|
+
CocoLabel[CocoLabel["BOWL"] = 51] = "BOWL";
|
|
53
|
+
CocoLabel[CocoLabel["BANANA"] = 52] = "BANANA";
|
|
54
|
+
CocoLabel[CocoLabel["APPLE"] = 53] = "APPLE";
|
|
55
|
+
CocoLabel[CocoLabel["SANDWICH"] = 54] = "SANDWICH";
|
|
56
|
+
CocoLabel[CocoLabel["ORANGE"] = 55] = "ORANGE";
|
|
57
|
+
CocoLabel[CocoLabel["BROCCOLI"] = 56] = "BROCCOLI";
|
|
58
|
+
CocoLabel[CocoLabel["CARROT"] = 57] = "CARROT";
|
|
59
|
+
CocoLabel[CocoLabel["HOT_DOG"] = 58] = "HOT_DOG";
|
|
60
|
+
CocoLabel[CocoLabel["PIZZA"] = 59] = "PIZZA";
|
|
61
|
+
CocoLabel[CocoLabel["DONUT"] = 60] = "DONUT";
|
|
62
|
+
CocoLabel[CocoLabel["CAKE"] = 61] = "CAKE";
|
|
63
|
+
CocoLabel[CocoLabel["CHAIR"] = 62] = "CHAIR";
|
|
64
|
+
CocoLabel[CocoLabel["COUCH"] = 63] = "COUCH";
|
|
65
|
+
CocoLabel[CocoLabel["POTTED_PLANT"] = 64] = "POTTED_PLANT";
|
|
66
|
+
CocoLabel[CocoLabel["BED"] = 65] = "BED";
|
|
67
|
+
CocoLabel[CocoLabel["MIRROR"] = 66] = "MIRROR";
|
|
68
|
+
CocoLabel[CocoLabel["DINING_TABLE"] = 67] = "DINING_TABLE";
|
|
69
|
+
CocoLabel[CocoLabel["WINDOW"] = 68] = "WINDOW";
|
|
70
|
+
CocoLabel[CocoLabel["DESK"] = 69] = "DESK";
|
|
71
|
+
CocoLabel[CocoLabel["TOILET"] = 70] = "TOILET";
|
|
72
|
+
CocoLabel[CocoLabel["DOOR"] = 71] = "DOOR";
|
|
73
|
+
CocoLabel[CocoLabel["TV"] = 72] = "TV";
|
|
74
|
+
CocoLabel[CocoLabel["LAPTOP"] = 73] = "LAPTOP";
|
|
75
|
+
CocoLabel[CocoLabel["MOUSE"] = 74] = "MOUSE";
|
|
76
|
+
CocoLabel[CocoLabel["REMOTE"] = 75] = "REMOTE";
|
|
77
|
+
CocoLabel[CocoLabel["KEYBOARD"] = 76] = "KEYBOARD";
|
|
78
|
+
CocoLabel[CocoLabel["CELL_PHONE"] = 77] = "CELL_PHONE";
|
|
79
|
+
CocoLabel[CocoLabel["MICROWAVE"] = 78] = "MICROWAVE";
|
|
80
|
+
CocoLabel[CocoLabel["OVEN"] = 79] = "OVEN";
|
|
81
|
+
CocoLabel[CocoLabel["TOASTER"] = 80] = "TOASTER";
|
|
82
|
+
CocoLabel[CocoLabel["SINK"] = 81] = "SINK";
|
|
83
|
+
CocoLabel[CocoLabel["REFRIGERATOR"] = 82] = "REFRIGERATOR";
|
|
84
|
+
CocoLabel[CocoLabel["BLENDER"] = 83] = "BLENDER";
|
|
85
|
+
CocoLabel[CocoLabel["BOOK"] = 84] = "BOOK";
|
|
86
|
+
CocoLabel[CocoLabel["CLOCK"] = 85] = "CLOCK";
|
|
87
|
+
CocoLabel[CocoLabel["VASE"] = 86] = "VASE";
|
|
88
|
+
CocoLabel[CocoLabel["SCISSORS"] = 87] = "SCISSORS";
|
|
89
|
+
CocoLabel[CocoLabel["TEDDY_BEAR"] = 88] = "TEDDY_BEAR";
|
|
90
|
+
CocoLabel[CocoLabel["HAIR_DRIER"] = 89] = "HAIR_DRIER";
|
|
91
|
+
CocoLabel[CocoLabel["TOOTHBRUSH"] = 90] = "TOOTHBRUSH";
|
|
92
|
+
CocoLabel[CocoLabel["HAIR_BRUSH"] = 91] = "HAIR_BRUSH";
|
|
93
|
+
})(CocoLabel || (CocoLabel = {}));
|
|
94
|
+
export {};
|
package/lib/types/ocr.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
+
export declare enum SpeechToTextLanguage {
|
|
14
|
+
Afrikaans = "af",
|
|
15
|
+
Albanian = "sq",
|
|
16
|
+
Arabic = "ar",
|
|
17
|
+
Armenian = "hy",
|
|
18
|
+
Azerbaijani = "az",
|
|
19
|
+
Basque = "eu",
|
|
20
|
+
Belarusian = "be",
|
|
21
|
+
Bengali = "bn",
|
|
22
|
+
Bosnian = "bs",
|
|
23
|
+
Bulgarian = "bg",
|
|
24
|
+
Burmese = "my",
|
|
25
|
+
Catalan = "ca",
|
|
26
|
+
Chinese = "zh",
|
|
27
|
+
Croatian = "hr",
|
|
28
|
+
Czech = "cs",
|
|
29
|
+
Danish = "da",
|
|
30
|
+
Dutch = "nl",
|
|
31
|
+
Estonian = "et",
|
|
32
|
+
English = "en",
|
|
33
|
+
Finnish = "fi",
|
|
34
|
+
French = "fr",
|
|
35
|
+
Galician = "gl",
|
|
36
|
+
Georgian = "ka",
|
|
37
|
+
German = "de",
|
|
38
|
+
Greek = "el",
|
|
39
|
+
Gujarati = "gu",
|
|
40
|
+
HaitianCreole = "ht",
|
|
41
|
+
Hebrew = "he",
|
|
42
|
+
Hindi = "hi",
|
|
43
|
+
Hungarian = "hu",
|
|
44
|
+
Icelandic = "is",
|
|
45
|
+
Indonesian = "id",
|
|
46
|
+
Italian = "it",
|
|
47
|
+
Japanese = "ja",
|
|
48
|
+
Kannada = "kn",
|
|
49
|
+
Kazakh = "kk",
|
|
50
|
+
Khmer = "km",
|
|
51
|
+
Korean = "ko",
|
|
52
|
+
Lao = "lo",
|
|
53
|
+
Latvian = "lv",
|
|
54
|
+
Lithuanian = "lt",
|
|
55
|
+
Macedonian = "mk",
|
|
56
|
+
Malagasy = "mg",
|
|
57
|
+
Malay = "ms",
|
|
58
|
+
Malayalam = "ml",
|
|
59
|
+
Maltese = "mt",
|
|
60
|
+
Marathi = "mr",
|
|
61
|
+
Nepali = "ne",
|
|
62
|
+
Norwegian = "no",
|
|
63
|
+
Persian = "fa",
|
|
64
|
+
Polish = "pl",
|
|
65
|
+
Portuguese = "pt",
|
|
66
|
+
Punjabi = "pa",
|
|
67
|
+
Romanian = "ro",
|
|
68
|
+
Russian = "ru",
|
|
69
|
+
Serbian = "sr",
|
|
70
|
+
Sinhala = "si",
|
|
71
|
+
Slovak = "sk",
|
|
72
|
+
Slovenian = "sl",
|
|
73
|
+
Spanish = "es",
|
|
74
|
+
Sundanese = "su",
|
|
75
|
+
Swahili = "sw",
|
|
76
|
+
Swedish = "sv",
|
|
77
|
+
Tagalog = "tl",
|
|
78
|
+
Tajik = "tg",
|
|
79
|
+
Tamil = "ta",
|
|
80
|
+
Telugu = "te",
|
|
81
|
+
Thai = "th",
|
|
82
|
+
Turkish = "tr",
|
|
83
|
+
Ukrainian = "uk",
|
|
84
|
+
Urdu = "ur",
|
|
85
|
+
Uzbek = "uz",
|
|
86
|
+
Vietnamese = "vi",
|
|
87
|
+
Welsh = "cy",
|
|
88
|
+
Yiddish = "yi"
|
|
89
|
+
}
|
|
90
|
+
export declare enum AvailableModels {
|
|
91
|
+
WHISPER = "whisper",
|
|
92
|
+
MOONSHINE = "moonshine",
|
|
93
|
+
WHISPER_MULTILINGUAL = "whisperMultilingual"
|
|
94
|
+
}
|
package/lib/types/stt.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Those languages are supported just by whisper multilingual
|
|
2
|
+
export var SpeechToTextLanguage;
|
|
3
|
+
(function (SpeechToTextLanguage) {
|
|
4
|
+
SpeechToTextLanguage["Afrikaans"] = "af";
|
|
5
|
+
SpeechToTextLanguage["Albanian"] = "sq";
|
|
6
|
+
SpeechToTextLanguage["Arabic"] = "ar";
|
|
7
|
+
SpeechToTextLanguage["Armenian"] = "hy";
|
|
8
|
+
SpeechToTextLanguage["Azerbaijani"] = "az";
|
|
9
|
+
SpeechToTextLanguage["Basque"] = "eu";
|
|
10
|
+
SpeechToTextLanguage["Belarusian"] = "be";
|
|
11
|
+
SpeechToTextLanguage["Bengali"] = "bn";
|
|
12
|
+
SpeechToTextLanguage["Bosnian"] = "bs";
|
|
13
|
+
SpeechToTextLanguage["Bulgarian"] = "bg";
|
|
14
|
+
SpeechToTextLanguage["Burmese"] = "my";
|
|
15
|
+
SpeechToTextLanguage["Catalan"] = "ca";
|
|
16
|
+
SpeechToTextLanguage["Chinese"] = "zh";
|
|
17
|
+
SpeechToTextLanguage["Croatian"] = "hr";
|
|
18
|
+
SpeechToTextLanguage["Czech"] = "cs";
|
|
19
|
+
SpeechToTextLanguage["Danish"] = "da";
|
|
20
|
+
SpeechToTextLanguage["Dutch"] = "nl";
|
|
21
|
+
SpeechToTextLanguage["Estonian"] = "et";
|
|
22
|
+
SpeechToTextLanguage["English"] = "en";
|
|
23
|
+
SpeechToTextLanguage["Finnish"] = "fi";
|
|
24
|
+
SpeechToTextLanguage["French"] = "fr";
|
|
25
|
+
SpeechToTextLanguage["Galician"] = "gl";
|
|
26
|
+
SpeechToTextLanguage["Georgian"] = "ka";
|
|
27
|
+
SpeechToTextLanguage["German"] = "de";
|
|
28
|
+
SpeechToTextLanguage["Greek"] = "el";
|
|
29
|
+
SpeechToTextLanguage["Gujarati"] = "gu";
|
|
30
|
+
SpeechToTextLanguage["HaitianCreole"] = "ht";
|
|
31
|
+
SpeechToTextLanguage["Hebrew"] = "he";
|
|
32
|
+
SpeechToTextLanguage["Hindi"] = "hi";
|
|
33
|
+
SpeechToTextLanguage["Hungarian"] = "hu";
|
|
34
|
+
SpeechToTextLanguage["Icelandic"] = "is";
|
|
35
|
+
SpeechToTextLanguage["Indonesian"] = "id";
|
|
36
|
+
SpeechToTextLanguage["Italian"] = "it";
|
|
37
|
+
SpeechToTextLanguage["Japanese"] = "ja";
|
|
38
|
+
SpeechToTextLanguage["Kannada"] = "kn";
|
|
39
|
+
SpeechToTextLanguage["Kazakh"] = "kk";
|
|
40
|
+
SpeechToTextLanguage["Khmer"] = "km";
|
|
41
|
+
SpeechToTextLanguage["Korean"] = "ko";
|
|
42
|
+
SpeechToTextLanguage["Lao"] = "lo";
|
|
43
|
+
SpeechToTextLanguage["Latvian"] = "lv";
|
|
44
|
+
SpeechToTextLanguage["Lithuanian"] = "lt";
|
|
45
|
+
SpeechToTextLanguage["Macedonian"] = "mk";
|
|
46
|
+
SpeechToTextLanguage["Malagasy"] = "mg";
|
|
47
|
+
SpeechToTextLanguage["Malay"] = "ms";
|
|
48
|
+
SpeechToTextLanguage["Malayalam"] = "ml";
|
|
49
|
+
SpeechToTextLanguage["Maltese"] = "mt";
|
|
50
|
+
SpeechToTextLanguage["Marathi"] = "mr";
|
|
51
|
+
SpeechToTextLanguage["Nepali"] = "ne";
|
|
52
|
+
SpeechToTextLanguage["Norwegian"] = "no";
|
|
53
|
+
SpeechToTextLanguage["Persian"] = "fa";
|
|
54
|
+
SpeechToTextLanguage["Polish"] = "pl";
|
|
55
|
+
SpeechToTextLanguage["Portuguese"] = "pt";
|
|
56
|
+
SpeechToTextLanguage["Punjabi"] = "pa";
|
|
57
|
+
SpeechToTextLanguage["Romanian"] = "ro";
|
|
58
|
+
SpeechToTextLanguage["Russian"] = "ru";
|
|
59
|
+
SpeechToTextLanguage["Serbian"] = "sr";
|
|
60
|
+
SpeechToTextLanguage["Sinhala"] = "si";
|
|
61
|
+
SpeechToTextLanguage["Slovak"] = "sk";
|
|
62
|
+
SpeechToTextLanguage["Slovenian"] = "sl";
|
|
63
|
+
SpeechToTextLanguage["Spanish"] = "es";
|
|
64
|
+
SpeechToTextLanguage["Sundanese"] = "su";
|
|
65
|
+
SpeechToTextLanguage["Swahili"] = "sw";
|
|
66
|
+
SpeechToTextLanguage["Swedish"] = "sv";
|
|
67
|
+
SpeechToTextLanguage["Tagalog"] = "tl";
|
|
68
|
+
SpeechToTextLanguage["Tajik"] = "tg";
|
|
69
|
+
SpeechToTextLanguage["Tamil"] = "ta";
|
|
70
|
+
SpeechToTextLanguage["Telugu"] = "te";
|
|
71
|
+
SpeechToTextLanguage["Thai"] = "th";
|
|
72
|
+
SpeechToTextLanguage["Turkish"] = "tr";
|
|
73
|
+
SpeechToTextLanguage["Ukrainian"] = "uk";
|
|
74
|
+
SpeechToTextLanguage["Urdu"] = "ur";
|
|
75
|
+
SpeechToTextLanguage["Uzbek"] = "uz";
|
|
76
|
+
SpeechToTextLanguage["Vietnamese"] = "vi";
|
|
77
|
+
SpeechToTextLanguage["Welsh"] = "cy";
|
|
78
|
+
SpeechToTextLanguage["Yiddish"] = "yi";
|
|
79
|
+
})(SpeechToTextLanguage || (SpeechToTextLanguage = {}));
|
|
80
|
+
export var AvailableModels;
|
|
81
|
+
(function (AvailableModels) {
|
|
82
|
+
AvailableModels["WHISPER"] = "whisper";
|
|
83
|
+
AvailableModels["MOONSHINE"] = "moonshine";
|
|
84
|
+
AvailableModels["WHISPER_MULTILINGUAL"] = "whisperMultilingual";
|
|
85
|
+
})(AvailableModels || (AvailableModels = {}));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResourceSource } from '../types/common';
|
|
2
|
-
import { ChatConfig, LLMTool, Message, ToolsConfig } from '../types/llm';
|
|
2
|
+
import { ChatConfig, GenerationConfig, LLMTool, Message, ToolsConfig } from '../types/llm';
|
|
3
3
|
export declare class LLMController {
|
|
4
4
|
private nativeModule;
|
|
5
5
|
private chatConfig;
|
|
@@ -33,13 +33,15 @@ export declare class LLMController {
|
|
|
33
33
|
onDownloadProgressCallback?: (downloadProgress: number) => void;
|
|
34
34
|
}): Promise<void>;
|
|
35
35
|
setTokenCallback(tokenCallback: (token: string) => void): void;
|
|
36
|
-
configure({ chatConfig, toolsConfig, }: {
|
|
36
|
+
configure({ chatConfig, toolsConfig, generationConfig, }: {
|
|
37
37
|
chatConfig?: Partial<ChatConfig>;
|
|
38
38
|
toolsConfig?: ToolsConfig;
|
|
39
|
+
generationConfig?: GenerationConfig;
|
|
39
40
|
}): void;
|
|
40
41
|
delete(): void;
|
|
41
42
|
forward(input: string): Promise<void>;
|
|
42
43
|
interrupt(): void;
|
|
44
|
+
getGeneratedTokenCount(): number;
|
|
43
45
|
generate(messages: Message[], tools?: LLMTool[]): Promise<void>;
|
|
44
46
|
sendMessage(message: string): Promise<void>;
|
|
45
47
|
deleteMessage(index: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LLMController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,OAAO,EACL,UAAU,EACV,OAAO,EACP,OAAO,EAEP,WAAW,EACZ,MAAM,cAAc,CAAC;AAItB,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,OAAO,CAAC,CAA0B;IAC1C,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAiB;IAGxC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,sBAAsB,CAAsC;IACpE,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,oBAAoB,CAAkC;gBAElD,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,GACrB,EAAE;QACD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAC9C,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QAC7D,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QAC7C,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;KACxD;IA2BD,IAAW,QAAQ,WAElB;IACD,IAAW,OAAO,YAEjB;IACD,IAAW,YAAY,YAEtB;IACD,IAAW,cAAc,cAExB;IAEY,IAAI,CAAC,EAChB,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,0BAA0B,GAC3B,EAAE;QACD,WAAW,EAAE,cAAc,CAAC;QAC5B,eAAe,EAAE,cAAc,CAAC;QAChC,qBAAqB,EAAE,cAAc,CAAC;QACtC,0BAA0B,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;KACjE;
|
|
1
|
+
{"version":3,"file":"LLMController.d.ts","sourceRoot":"","sources":["../../../src/controllers/LLMController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMjD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,OAAO,EAEP,WAAW,EACZ,MAAM,cAAc,CAAC;AAItB,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,UAAU,CAAmC;IACrD,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,eAAe,CAAM;IAC7B,OAAO,CAAC,OAAO,CAAC,CAA0B;IAC1C,OAAO,CAAC,SAAS,CAAM;IACvB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,eAAe,CAAiB;IAGxC,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,sBAAsB,CAAsC;IACpE,OAAO,CAAC,eAAe,CAA6B;IACpD,OAAO,CAAC,oBAAoB,CAAkC;gBAElD,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,GACrB,EAAE;QACD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAC9C,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;QAC7D,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;QAC7C,oBAAoB,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;KACxD;IA2BD,IAAW,QAAQ,WAElB;IACD,IAAW,OAAO,YAEjB;IACD,IAAW,YAAY,YAEtB;IACD,IAAW,cAAc,cAExB;IAEY,IAAI,CAAC,EAChB,WAAW,EACX,eAAe,EACf,qBAAqB,EACrB,0BAA0B,GAC3B,EAAE;QACD,WAAW,EAAE,cAAc,CAAC;QAC5B,eAAe,EAAE,cAAc,CAAC;QAChC,qBAAqB,EAAE,cAAc,CAAC;QACtC,0BAA0B,CAAC,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;KACjE;IAmEM,gBAAgB,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;IAIvD,SAAS,CAAC,EACf,UAAU,EACV,WAAW,EACX,gBAAgB,GACjB,EAAE;QACD,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;IAiBM,MAAM;IAaA,OAAO,CAAC,KAAK,EAAE,MAAM;IAkB3B,SAAS;IAIT,sBAAsB,IAAI,MAAM;IAI1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE;IAwB/C,WAAW,CAAC,OAAO,EAAE,MAAM;IAuCjC,aAAa,CAAC,KAAK,EAAE,MAAM;IAQlC,OAAO,CAAC,iBAAiB;CAyB1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLLM.d.ts","sourceRoot":"","sources":["../../../../src/hooks/natural_language_processing/useLLM.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"useLLM.d.ts","sourceRoot":"","sources":["../../../../src/hooks/natural_language_processing/useLLM.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAIL,OAAO,EAGR,MAAM,iBAAiB,CAAC;AAMzB,eAAO,MAAM,MAAM,GAAI,yBAGpB;IACD,KAAK,EAAE;QACL,WAAW,EAAE,cAAc,CAAC;QAC5B,eAAe,EAAE,cAAc,CAAC;QAChC,qBAAqB,EAAE,cAAc,CAAC;KACvC,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,KAAG,OAwHH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResourceSource } from '../../types/common';
|
|
2
|
-
import { ChatConfig, LLMTool, Message, ToolsConfig } from '../../types/llm';
|
|
2
|
+
import { ChatConfig, GenerationConfig, LLMTool, Message, ToolsConfig } from '../../types/llm';
|
|
3
3
|
export declare class LLMModule {
|
|
4
4
|
private controller;
|
|
5
5
|
constructor({ tokenCallback, responseCallback, messageHistoryCallback, }?: {
|
|
@@ -15,15 +15,17 @@ export declare class LLMModule {
|
|
|
15
15
|
setTokenCallback({ tokenCallback, }: {
|
|
16
16
|
tokenCallback: (token: string) => void;
|
|
17
17
|
}): void;
|
|
18
|
-
configure({ chatConfig, toolsConfig, }: {
|
|
18
|
+
configure({ chatConfig, toolsConfig, generationConfig, }: {
|
|
19
19
|
chatConfig?: Partial<ChatConfig>;
|
|
20
20
|
toolsConfig?: ToolsConfig;
|
|
21
|
+
generationConfig?: GenerationConfig;
|
|
21
22
|
}): void;
|
|
22
23
|
forward(input: string): Promise<string>;
|
|
23
24
|
generate(messages: Message[], tools?: LLMTool[]): Promise<string>;
|
|
24
25
|
sendMessage(message: string): Promise<Message[]>;
|
|
25
26
|
deleteMessage(index: number): Message[];
|
|
26
27
|
interrupt(): void;
|
|
28
|
+
getGeneratedTokenCount(): number;
|
|
27
29
|
delete(): void;
|
|
28
30
|
}
|
|
29
31
|
//# sourceMappingURL=LLMModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LLMModule.d.ts","sourceRoot":"","sources":["../../../../src/modules/natural_language_processing/LLMModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"LLMModule.d.ts","sourceRoot":"","sources":["../../../../src/modules/natural_language_processing/LLMModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,qBAAa,SAAS;IACpB,OAAO,CAAC,UAAU,CAAgB;gBAEtB,EACV,aAAa,EACb,gBAAgB,EAChB,sBAAsB,GACvB,GAAE;QACD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACxC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;QAC9C,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;KACzD;IAQA,IAAI,CACR,KAAK,EAAE;QACL,WAAW,EAAE,cAAc,CAAC;QAC5B,eAAe,EAAE,cAAc,CAAC;QAChC,qBAAqB,EAAE,cAAc,CAAC;KACvC,EACD,0BAA0B,GAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAe;IAQnE,gBAAgB,CAAC,EACf,aAAa,GACd,EAAE;QACD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KACxC;IAID,SAAS,CAAC,EACR,UAAU,EACV,WAAW,EACX,gBAAgB,GACjB,EAAE;QACD,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC;IAIK,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKvC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKjE,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAKtD,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,EAAE;IAKvC,SAAS;IAIT,sBAAsB;IAItB,MAAM;CAGP"}
|
|
@@ -6,10 +6,12 @@ export interface LLMType {
|
|
|
6
6
|
isGenerating: boolean;
|
|
7
7
|
downloadProgress: number;
|
|
8
8
|
error: string | null;
|
|
9
|
-
configure: ({ chatConfig, toolsConfig, }: {
|
|
9
|
+
configure: ({ chatConfig, toolsConfig, generationConfig, }: {
|
|
10
10
|
chatConfig?: Partial<ChatConfig>;
|
|
11
11
|
toolsConfig?: ToolsConfig;
|
|
12
|
+
generationConfig?: GenerationConfig;
|
|
12
13
|
}) => void;
|
|
14
|
+
getGeneratedTokenCount: () => number;
|
|
13
15
|
generate: (messages: Message[], tools?: LLMTool[]) => Promise<void>;
|
|
14
16
|
sendMessage: (message: string) => Promise<void>;
|
|
15
17
|
deleteMessage: (index: number) => void;
|
|
@@ -35,6 +37,10 @@ export interface ToolsConfig {
|
|
|
35
37
|
executeToolCallback: (call: ToolCall) => Promise<string | null>;
|
|
36
38
|
displayToolCalls?: boolean;
|
|
37
39
|
}
|
|
40
|
+
export interface GenerationConfig {
|
|
41
|
+
outputTokenBatchSize?: number;
|
|
42
|
+
batchTimeInterval?: number;
|
|
43
|
+
}
|
|
38
44
|
export declare const SPECIAL_TOKENS: {
|
|
39
45
|
BOS_TOKEN: string;
|
|
40
46
|
EOS_TOKEN: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../../src/types/llm.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,EACV,UAAU,EACV,WAAW,
|
|
1
|
+
{"version":3,"file":"llm.d.ts","sourceRoot":"","sources":["../../../src/types/llm.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,GACjB,EAAE;QACD,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;QACjC,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;KACrC,KAAK,IAAI,CAAC;IACX,sBAAsB,EAAE,MAAM,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAID,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B,MAAM,WAAW,UAAU;IACzB,qBAAqB,EAAE,OAAO,EAAE,CAAC;IACjC,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,mBAAmB,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc;;;;;;;;CAQ1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResourceSource } from '../types/common';
|
|
2
|
+
import { DownloadResource } from './ResourceFetcherUtils';
|
|
3
|
+
export declare class ResourceFetcher {
|
|
4
|
+
static downloads: Map<ResourceSource, DownloadResource>;
|
|
5
|
+
static fetch(callback?: (downloadProgress: number) => void, ...sources: ResourceSource[]): Promise<string[] | null>;
|
|
6
|
+
private static singleFetch;
|
|
7
|
+
private static returnOrStartNext;
|
|
8
|
+
private static pause;
|
|
9
|
+
private static resume;
|
|
10
|
+
private static cancel;
|
|
11
|
+
static pauseFetching(...sources: ResourceSource[]): Promise<void>;
|
|
12
|
+
static resumeFetching(...sources: ResourceSource[]): Promise<void>;
|
|
13
|
+
static cancelFetching(...sources: ResourceSource[]): Promise<void>;
|
|
14
|
+
private static findActive;
|
|
15
|
+
static listDownloadedFiles(): Promise<string[]>;
|
|
16
|
+
static listDownloadedModels(): Promise<string[]>;
|
|
17
|
+
static deleteResources(...sources: ResourceSource[]): Promise<void>;
|
|
18
|
+
static getFilesTotalSize(...sources: ResourceSource[]): Promise<number>;
|
|
19
|
+
private static handleObject;
|
|
20
|
+
private static handleLocalFile;
|
|
21
|
+
private static handleReleaseModeFile;
|
|
22
|
+
private static handleDevModeFile;
|
|
23
|
+
private static handleRemoteFile;
|
|
24
|
+
}
|