cactus-react-native 0.2.11 → 1.0.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.
- package/Cactus.podspec +34 -0
- package/LICENSE +38 -0
- package/README.md +354 -69
- package/android/CMakeLists.txt +40 -0
- package/android/build.gradle +68 -44
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -3
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/cactus/CactusPackage.kt +22 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusCrypto.kt +38 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusDeviceInfo.kt +24 -0
- package/android/src/main/java/com/margelo/nitro/cactus/HybridCactusFileSystem.kt +227 -0
- package/android/src/main/jniLibs/arm64-v8a/{libcactus_v8_2_dotprod.so → libcactus.a} +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_util.so +0 -0
- package/cpp/HybridCactus.cpp +123 -0
- package/cpp/HybridCactus.hpp +35 -0
- package/cpp/HybridCactusUtil.cpp +45 -0
- package/cpp/HybridCactusUtil.hpp +26 -0
- package/cpp/cactus_ffi.h +55 -0
- package/cpp/cactus_util.h +25 -0
- package/ios/HybridCactusCrypto.swift +37 -0
- package/ios/HybridCactusDeviceInfo.swift +32 -0
- package/ios/HybridCactusFileSystem.swift +234 -0
- package/ios/cactus.xcframework/{info.plist → Info.plist} +2 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus.h +8 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/cactus_ffi.h +28 -229
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus.h +11 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/cactus_ffi.h +55 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/engine.h +347 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/ffi_utils.h +286 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/graph.h +319 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel.h +254 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Headers/kernel_utils.h +343 -0
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/{tvos-arm64_x86_64-simulator → ios-arm64-simulator}/cactus.framework/_CodeSignature/CodeResources +1 -1
- package/ios/cactus.xcframework/ios-arm64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus_util.xcframework/Info.plist +39 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/cactus_util.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Headers/logging.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/Info.plist +0 -0
- package/ios/cactus_util.xcframework/ios-arm64/cactus_util.framework/cactus_util +0 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/cactus_util.h +25 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/ios_utils.h +10 -0
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/Headers/logging.h +25 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/Info.plist +0 -0
- package/ios/{cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework → cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework}/_CodeSignature/CodeResources +36 -2
- package/ios/cactus_util.xcframework/ios-arm64-simulator/cactus_util.framework/cactus_util +0 -0
- package/lib/module/api/Database.js +60 -0
- package/lib/module/api/Database.js.map +1 -0
- package/lib/module/classes/CactusLM.js +149 -0
- package/lib/module/classes/CactusLM.js.map +1 -0
- package/lib/module/config/CactusConfig.js +6 -0
- package/lib/module/config/CactusConfig.js.map +1 -0
- package/lib/module/constants/packageVersion.js +4 -0
- package/lib/module/constants/packageVersion.js.map +1 -0
- package/lib/module/hooks/useCactusLM.js +233 -0
- package/lib/module/hooks/useCactusLM.js.map +1 -0
- package/lib/module/index.js +9 -409
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/Cactus.js +50 -0
- package/lib/module/native/Cactus.js.map +1 -0
- package/lib/module/native/CactusCrypto.js +10 -0
- package/lib/module/native/CactusCrypto.js.map +1 -0
- package/lib/module/native/CactusDeviceInfo.js +13 -0
- package/lib/module/native/CactusDeviceInfo.js.map +1 -0
- package/lib/module/native/CactusFileSystem.js +35 -0
- package/lib/module/native/CactusFileSystem.js.map +1 -0
- package/lib/module/native/CactusUtil.js +23 -0
- package/lib/module/native/CactusUtil.js.map +1 -0
- package/lib/module/native/index.js +8 -0
- package/lib/module/native/index.js.map +1 -0
- package/lib/module/specs/Cactus.nitro.js +4 -0
- package/lib/module/specs/Cactus.nitro.js.map +1 -0
- package/lib/module/specs/CactusCrypto.nitro.js +4 -0
- package/lib/module/specs/CactusCrypto.nitro.js.map +1 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js +4 -0
- package/lib/module/specs/CactusDeviceInfo.nitro.js.map +1 -0
- package/lib/module/specs/CactusFileSystem.nitro.js +4 -0
- package/lib/module/specs/CactusFileSystem.nitro.js.map +1 -0
- package/lib/module/specs/CactusUtil.nitro.js +4 -0
- package/lib/module/specs/CactusUtil.nitro.js.map +1 -0
- package/lib/module/telemetry/Telemetry.js +100 -0
- package/lib/module/telemetry/Telemetry.js.map +1 -0
- package/lib/module/types/CactusLM.js +2 -0
- package/lib/module/types/CactusLM.js.map +1 -0
- package/lib/module/types/CactusModel.js +2 -0
- package/lib/module/types/CactusModel.js.map +1 -0
- package/lib/module/utils/error.js +4 -0
- package/lib/module/utils/error.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/api/Database.d.ts +11 -0
- package/lib/typescript/src/api/Database.d.ts.map +1 -0
- package/lib/typescript/src/classes/CactusLM.d.ts +25 -0
- package/lib/typescript/src/classes/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/config/CactusConfig.d.ts +5 -0
- package/lib/typescript/src/config/CactusConfig.d.ts.map +1 -0
- package/lib/typescript/src/constants/packageVersion.d.ts +2 -0
- package/lib/typescript/src/constants/packageVersion.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts +20 -0
- package/lib/typescript/src/hooks/useCactusLM.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/native/Cactus.d.ts +11 -0
- package/lib/typescript/src/native/Cactus.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts +5 -0
- package/lib/typescript/src/native/CactusCrypto.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts +7 -0
- package/lib/typescript/src/native/CactusDeviceInfo.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts +13 -0
- package/lib/typescript/src/native/CactusFileSystem.d.ts.map +1 -0
- package/lib/typescript/src/native/CactusUtil.d.ts +6 -0
- package/lib/typescript/src/native/CactusUtil.d.ts.map +1 -0
- package/lib/typescript/src/native/index.d.ts +6 -0
- package/lib/typescript/src/native/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts +13 -0
- package/lib/typescript/src/specs/Cactus.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts +8 -0
- package/lib/typescript/src/specs/CactusCrypto.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusDeviceInfo.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/CactusFileSystem.nitro.d.ts.map +1 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts +10 -0
- package/lib/typescript/src/specs/CactusUtil.nitro.d.ts.map +1 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts +30 -0
- package/lib/typescript/src/telemetry/Telemetry.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusLM.d.ts +65 -0
- package/lib/typescript/src/types/CactusLM.d.ts.map +1 -0
- package/lib/typescript/src/types/CactusModel.d.ts +12 -0
- package/lib/typescript/src/types/CactusModel.d.ts.map +1 -0
- package/lib/typescript/src/utils/error.d.ts +2 -0
- package/lib/typescript/src/utils/error.d.ts.map +1 -0
- package/nitro.json +31 -0
- package/nitrogen/generated/android/c++/JDeviceInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +74 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.cpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusCryptoSpec.hpp +65 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.cpp +85 -0
- package/nitrogen/generated/android/c++/JHybridCactusDeviceInfoSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.cpp +192 -0
- package/nitrogen/generated/android/c++/JHybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/android/cactus+autolinking.cmake +87 -0
- package/nitrogen/generated/android/cactus+autolinking.gradle +27 -0
- package/nitrogen/generated/android/cactusOnLoad.cpp +86 -0
- package/nitrogen/generated/android/cactusOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/DeviceInfo.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/Func_void_double.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusCryptoSpec.kt +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusDeviceInfoSpec.kt +62 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/HybridCactusFileSystemSpec.kt +95 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/cactus/cactusOnLoad.kt +35 -0
- package/nitrogen/generated/ios/Cactus+autolinking.rb +60 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.cpp +122 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Bridge.hpp +373 -0
- package/nitrogen/generated/ios/Cactus-Swift-Cxx-Umbrella.hpp +60 -0
- package/nitrogen/generated/ios/CactusAutolinking.mm +69 -0
- package/nitrogen/generated/ios/CactusAutolinking.swift +55 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusCryptoSpecSwift.hpp +77 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusDeviceInfoSpecSwift.hpp +88 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridCactusFileSystemSpecSwift.hpp +143 -0
- package/nitrogen/generated/ios/swift/DeviceInfo.swift +98 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_DeviceInfo.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__optional_std__string_.swift +54 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec.swift +57 -0
- package/nitrogen/generated/ios/swift/HybridCactusCryptoSpec_cxx.swift +139 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridCactusDeviceInfoSpec_cxx.swift +164 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec.swift +65 -0
- package/nitrogen/generated/ios/swift/HybridCactusFileSystemSpec_cxx.swift +303 -0
- package/nitrogen/generated/shared/c++/DeviceInfo.hpp +92 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridCactusCryptoSpec.hpp +63 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridCactusDeviceInfoSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridCactusFileSystemSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.cpp +26 -0
- package/nitrogen/generated/shared/c++/HybridCactusSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridCactusUtilSpec.hpp +66 -0
- package/package.json +84 -143
- package/src/api/Database.ts +83 -0
- package/src/classes/CactusLM.ts +203 -0
- package/src/config/CactusConfig.ts +4 -0
- package/src/constants/packageVersion.ts +1 -0
- package/src/hooks/useCactusLM.ts +282 -0
- package/src/index.tsx +23 -0
- package/src/native/Cactus.ts +79 -0
- package/src/native/CactusCrypto.ts +11 -0
- package/src/native/CactusDeviceInfo.ts +18 -0
- package/src/native/CactusFileSystem.ts +47 -0
- package/src/native/CactusUtil.ts +27 -0
- package/src/native/index.ts +5 -0
- package/src/specs/Cactus.nitro.ts +16 -0
- package/src/specs/CactusCrypto.nitro.ts +6 -0
- package/src/specs/CactusDeviceInfo.nitro.ts +15 -0
- package/src/specs/CactusFileSystem.nitro.ts +21 -0
- package/src/specs/CactusUtil.nitro.ts +8 -0
- package/src/telemetry/Telemetry.ts +159 -0
- package/src/types/CactusLM.ts +71 -0
- package/src/types/CactusModel.ts +14 -0
- package/src/utils/error.ts +2 -0
- package/LICENSE.txt +0 -20
- package/android/src/main/CMakeLists.txt +0 -140
- package/android/src/main/java/com/cactus/Cactus.java +0 -1190
- package/android/src/main/java/com/cactus/CactusPackage.java +0 -48
- package/android/src/main/java/com/cactus/LlamaContext.java +0 -748
- package/android/src/main/jni-utils.h +0 -100
- package/android/src/main/jni.cpp +0 -1605
- package/android/src/main/jniLibs/arm64-v8a/libcactus.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_dotprod_i8mm.so +0 -0
- package/android/src/main/jniLibs/arm64-v8a/libcactus_v8_2_i8mm.so +0 -0
- package/android/src/newarch/java/com/cactus/CactusModule.java +0 -204
- package/android/src/oldarch/java/com/cactus/CactusModule.java +0 -205
- package/cactus-react-native.podspec +0 -42
- package/ios/CMakeLists.txt +0 -131
- package/ios/Cactus.h +0 -6
- package/ios/Cactus.mm +0 -681
- package/ios/CactusContext.h +0 -81
- package/ios/CactusContext.mm +0 -1032
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/ios-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64/cactus.framework/ggml-llama.metallib +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus.h +0 -232
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/cactus_ffi.h +0 -256
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/chat.h +0 -145
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/common.h +0 -674
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-alloc.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend-impl.h +0 -255
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-backend.h +0 -354
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-common.h +0 -1857
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpp.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-cpu.h +0 -143
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-impl.h +0 -601
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal-impl.h +0 -622
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-metal.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-opt.h +0 -237
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-quants.h +0 -100
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml-threading.h +0 -14
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/ggml.h +0 -2202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/gguf.h +0 -202
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json-schema-to-grammar.h +0 -21
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/json.hpp +0 -24766
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-adapter.h +0 -76
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-arch.h +0 -437
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-batch.h +0 -89
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-chat.h +0 -58
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-context.h +0 -276
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cparams.h +0 -39
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-cpp.h +0 -30
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-grammar.h +0 -173
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-graph.h +0 -640
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-hparams.h +0 -190
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-impl.h +0 -61
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-io.h +0 -35
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-kv-cache.h +0 -515
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-memory.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-mmap.h +0 -68
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-loader.h +0 -169
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model-saver.h +0 -37
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-model.h +0 -425
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-sampling.h +0 -32
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama-vocab.h +0 -131
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/llama.h +0 -1376
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/log.h +0 -103
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/chat-template.hpp +0 -542
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/minja/minja.hpp +0 -2974
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h +0 -107
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h +0 -20
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h +0 -66
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Info.plist +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/cactus +0 -0
- package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib +0 -0
- package/lib/commonjs/NativeCactus.js +0 -9
- package/lib/commonjs/NativeCactus.js.map +0 -1
- package/lib/commonjs/agent.js +0 -73
- package/lib/commonjs/agent.js.map +0 -1
- package/lib/commonjs/chat.js +0 -73
- package/lib/commonjs/chat.js.map +0 -1
- package/lib/commonjs/index.js +0 -523
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/lm.js +0 -272
- package/lib/commonjs/lm.js.map +0 -1
- package/lib/commonjs/package.json +0 -1
- package/lib/commonjs/projectId.js +0 -9
- package/lib/commonjs/projectId.js.map +0 -1
- package/lib/commonjs/remote.js +0 -100
- package/lib/commonjs/remote.js.map +0 -1
- package/lib/commonjs/telemetry.js +0 -102
- package/lib/commonjs/telemetry.js.map +0 -1
- package/lib/commonjs/tools.js +0 -72
- package/lib/commonjs/tools.js.map +0 -1
- package/lib/commonjs/tts.js +0 -141
- package/lib/commonjs/tts.js.map +0 -1
- package/lib/commonjs/vlm.js +0 -221
- package/lib/commonjs/vlm.js.map +0 -1
- package/lib/module/NativeCactus.js +0 -5
- package/lib/module/NativeCactus.js.map +0 -1
- package/lib/module/agent.js +0 -68
- package/lib/module/agent.js.map +0 -1
- package/lib/module/chat.js +0 -67
- package/lib/module/chat.js.map +0 -1
- package/lib/module/lm.js +0 -267
- package/lib/module/lm.js.map +0 -1
- package/lib/module/projectId.js +0 -5
- package/lib/module/projectId.js.map +0 -1
- package/lib/module/remote.js +0 -91
- package/lib/module/remote.js.map +0 -1
- package/lib/module/telemetry.js +0 -97
- package/lib/module/telemetry.js.map +0 -1
- package/lib/module/tools.js +0 -66
- package/lib/module/tools.js.map +0 -1
- package/lib/module/tts.js +0 -135
- package/lib/module/tts.js.map +0 -1
- package/lib/module/vlm.js +0 -216
- package/lib/module/vlm.js.map +0 -1
- package/lib/typescript/NativeCactus.d.ts +0 -252
- package/lib/typescript/NativeCactus.d.ts.map +0 -1
- package/lib/typescript/agent.d.ts +0 -31
- package/lib/typescript/agent.d.ts.map +0 -1
- package/lib/typescript/chat.d.ts +0 -23
- package/lib/typescript/chat.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -114
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/lm.d.ts +0 -36
- package/lib/typescript/lm.d.ts.map +0 -1
- package/lib/typescript/projectId.d.ts +0 -2
- package/lib/typescript/projectId.d.ts.map +0 -1
- package/lib/typescript/remote.d.ts +0 -8
- package/lib/typescript/remote.d.ts.map +0 -1
- package/lib/typescript/telemetry.d.ts +0 -25
- package/lib/typescript/telemetry.d.ts.map +0 -1
- package/lib/typescript/tools.d.ts +0 -36
- package/lib/typescript/tools.d.ts.map +0 -1
- package/lib/typescript/tts.d.ts +0 -54
- package/lib/typescript/tts.d.ts.map +0 -1
- package/lib/typescript/vlm.d.ts +0 -33
- package/lib/typescript/vlm.d.ts.map +0 -1
- package/scripts/postInstall.js +0 -33
- package/src/NativeCactus.ts +0 -317
- package/src/agent.ts +0 -112
- package/src/chat.ts +0 -91
- package/src/index.ts +0 -663
- package/src/lm.ts +0 -324
- package/src/projectId.ts +0 -1
- package/src/remote.ts +0 -113
- package/src/telemetry.ts +0 -137
- package/src/tools.ts +0 -94
- package/src/tts.ts +0 -236
- package/src/vlm.ts +0 -276
package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/sampling.h
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include "llama.h"
|
|
4
|
-
|
|
5
|
-
#include "common.h"
|
|
6
|
-
|
|
7
|
-
#include <string>
|
|
8
|
-
#include <vector>
|
|
9
|
-
|
|
10
|
-
// common_sampler extends llama_sampler with additional functionality:
|
|
11
|
-
//
|
|
12
|
-
// - grammar support
|
|
13
|
-
// - custom sampler logic based on the parameters
|
|
14
|
-
// - history of the last accepted tokens
|
|
15
|
-
// - performance metrics
|
|
16
|
-
//
|
|
17
|
-
// This goal is to have a common implementation of the sampling logic shared across the examples.
|
|
18
|
-
// For example, depending on the temperature, the sampling chain can be very simple (greedy) or more
|
|
19
|
-
// complex (top-k, top-p, etc).
|
|
20
|
-
//
|
|
21
|
-
// Another example is related to the grammar. In general, the grammar constraints applied on the full
|
|
22
|
-
// vocabulary can be very taxing. To improve performance, the grammar can be applied only to the sampled
|
|
23
|
-
// token in order to verify if it fits the grammar. And only if the token doesn't fit the grammar, the
|
|
24
|
-
// grammar constraints are applied to the full vocabulary and the token is resampled.
|
|
25
|
-
//
|
|
26
|
-
// The common_sampler also maintains a container with the last accepted tokens. In the future, this can
|
|
27
|
-
// be moved into the core llama library.
|
|
28
|
-
//
|
|
29
|
-
// For convenience, the common_sampler also maintains a container with the current candidate tokens.
|
|
30
|
-
// This can be used to access the probabilities of the rest of the non-sampled tokens.
|
|
31
|
-
//
|
|
32
|
-
// TODO: measure grammar performance
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
struct common_sampler;
|
|
36
|
-
|
|
37
|
-
// llama_sampler API overloads
|
|
38
|
-
|
|
39
|
-
struct common_sampler * common_sampler_init(const struct llama_model * model, const struct common_params_sampling & params);
|
|
40
|
-
|
|
41
|
-
void common_sampler_free(struct common_sampler * gsmpl);
|
|
42
|
-
|
|
43
|
-
// if accept_grammar is true, the token is accepted both by the sampling chain and the grammar
|
|
44
|
-
void common_sampler_accept(struct common_sampler * gsmpl, llama_token token, bool accept_grammar);
|
|
45
|
-
void common_sampler_reset (struct common_sampler * gsmpl);
|
|
46
|
-
struct common_sampler * common_sampler_clone (struct common_sampler * gsmpl);
|
|
47
|
-
|
|
48
|
-
// arguments can be nullptr to skip printing
|
|
49
|
-
void common_perf_print(const struct llama_context * ctx, const struct common_sampler * gsmpl);
|
|
50
|
-
|
|
51
|
-
// extended sampling implementation:
|
|
52
|
-
//
|
|
53
|
-
// - set logits
|
|
54
|
-
// - apply the configured sampler chain
|
|
55
|
-
// - check if the token fits the grammar (if any)
|
|
56
|
-
// - if not: resample by first applying the grammar constraints and then sampling again (slower path)
|
|
57
|
-
//
|
|
58
|
-
// if grammar_first is true, the grammar is applied before the samplers (slower)
|
|
59
|
-
// useful in cases where all the resulting candidates (not just the sampled one) must fit the grammar
|
|
60
|
-
//
|
|
61
|
-
llama_token common_sampler_sample(struct common_sampler * gsmpl, struct llama_context * ctx, int idx, bool grammar_first = false);
|
|
62
|
-
|
|
63
|
-
// generalized version of common_sampler_sample
|
|
64
|
-
//
|
|
65
|
-
// will cross-reference the sampled tokens with a batch of draft tokens and accept those that match
|
|
66
|
-
// if the sampler disagrees at some point, we stop and return the accepted tokens up to now
|
|
67
|
-
//
|
|
68
|
-
// common_sampler_sample_n(gsmpl, ctx, { idx }, {});
|
|
69
|
-
//
|
|
70
|
-
// is equivalent to
|
|
71
|
-
//
|
|
72
|
-
// common_sampler_sample(gsmpl, ctx, idx);
|
|
73
|
-
// common_sampler_accept(gsmpl, token, true);
|
|
74
|
-
//
|
|
75
|
-
// requires: idxs.size() == draft.size() + 1
|
|
76
|
-
//
|
|
77
|
-
// returns at least 1 token, up to idxs.size()
|
|
78
|
-
//
|
|
79
|
-
std::vector<llama_token> common_sampler_sample_and_accept_n(struct common_sampler * gsmpl, struct llama_context * ctx, const std::vector<int> & idxs, const llama_tokens & draft, bool grammar_first = false);
|
|
80
|
-
|
|
81
|
-
// assume idxs == [ 0, 1, 2, ..., draft.size() ]
|
|
82
|
-
std::vector<llama_token> common_sampler_sample_and_accept_n(struct common_sampler * gsmpl, struct llama_context * ctx, const llama_tokens & draft, bool grammar_first = false);
|
|
83
|
-
|
|
84
|
-
uint32_t common_sampler_get_seed(const struct common_sampler * gsmpl);
|
|
85
|
-
|
|
86
|
-
// helpers
|
|
87
|
-
|
|
88
|
-
// access the internal list of current candidate tokens
|
|
89
|
-
llama_token_data_array * common_sampler_get_candidates(struct common_sampler * gsmpl);
|
|
90
|
-
|
|
91
|
-
// get the last accepted token
|
|
92
|
-
llama_token common_sampler_last(const struct common_sampler * gsmpl);
|
|
93
|
-
|
|
94
|
-
// print the sampler chain into a string
|
|
95
|
-
std::string common_sampler_print(const struct common_sampler * gsmpl);
|
|
96
|
-
|
|
97
|
-
// get a string representation of the last accepted tokens
|
|
98
|
-
std::string common_sampler_prev_str(common_sampler * gsmpl, llama_context * ctx, int n);
|
|
99
|
-
|
|
100
|
-
char common_sampler_type_to_chr(enum common_sampler_type cnstr);
|
|
101
|
-
std::string common_sampler_type_to_str(enum common_sampler_type cnstr);
|
|
102
|
-
|
|
103
|
-
std::vector<enum common_sampler_type> common_sampler_types_from_names(const std::vector<std::string> & names, bool allow_alt_names);
|
|
104
|
-
std::vector<enum common_sampler_type> common_sampler_types_from_chars(const std::string & chars);
|
|
105
|
-
|
|
106
|
-
llama_sampler * llama_sampler_init_llg(const llama_vocab * vocab,
|
|
107
|
-
const char * grammar_kind, const char * grammar_data);
|
package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode-data.h
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <cstdint>
|
|
4
|
-
#include <vector>
|
|
5
|
-
#include <unordered_map>
|
|
6
|
-
#include <unordered_set>
|
|
7
|
-
|
|
8
|
-
struct range_nfd {
|
|
9
|
-
uint32_t first;
|
|
10
|
-
uint32_t last;
|
|
11
|
-
uint32_t nfd;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
static const uint32_t MAX_CODEPOINTS = 0x110000;
|
|
15
|
-
|
|
16
|
-
extern const std::initializer_list<std::pair<uint32_t, uint16_t>> unicode_ranges_flags;
|
|
17
|
-
extern const std::unordered_set<uint32_t> unicode_set_whitespace;
|
|
18
|
-
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_lowercase;
|
|
19
|
-
extern const std::initializer_list<std::pair<uint32_t, uint32_t>> unicode_map_uppercase;
|
|
20
|
-
extern const std::initializer_list<range_nfd> unicode_ranges_nfd;
|
package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/Headers/unicode.h
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#pragma once
|
|
2
|
-
|
|
3
|
-
#include <cstdint>
|
|
4
|
-
#include <string>
|
|
5
|
-
#include <vector>
|
|
6
|
-
|
|
7
|
-
struct unicode_cpt_flags {
|
|
8
|
-
enum {
|
|
9
|
-
UNDEFINED = 0x0001,
|
|
10
|
-
NUMBER = 0x0002, // regex: \p{N}
|
|
11
|
-
LETTER = 0x0004, // regex: \p{L}
|
|
12
|
-
SEPARATOR = 0x0008, // regex: \p{Z}
|
|
13
|
-
ACCENT_MARK = 0x0010, // regex: \p{M}
|
|
14
|
-
PUNCTUATION = 0x0020, // regex: \p{P}
|
|
15
|
-
SYMBOL = 0x0040, // regex: \p{S}
|
|
16
|
-
CONTROL = 0x0080, // regex: \p{C}
|
|
17
|
-
MASK_CATEGORIES = 0x00FF,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
// codepoint type
|
|
21
|
-
uint16_t is_undefined : 1;
|
|
22
|
-
uint16_t is_number : 1; // regex: \p{N}
|
|
23
|
-
uint16_t is_letter : 1; // regex: \p{L}
|
|
24
|
-
uint16_t is_separator : 1; // regex: \p{Z}
|
|
25
|
-
uint16_t is_accent_mark : 1; // regex: \p{M}
|
|
26
|
-
uint16_t is_punctuation : 1; // regex: \p{P}
|
|
27
|
-
uint16_t is_symbol : 1; // regex: \p{S}
|
|
28
|
-
uint16_t is_control : 1; // regex: \p{C}
|
|
29
|
-
// helper flags
|
|
30
|
-
uint16_t is_whitespace : 1; // regex: \s
|
|
31
|
-
uint16_t is_lowercase : 1;
|
|
32
|
-
uint16_t is_uppercase : 1;
|
|
33
|
-
uint16_t is_nfd : 1;
|
|
34
|
-
|
|
35
|
-
// decode from uint16
|
|
36
|
-
inline unicode_cpt_flags(const uint16_t flags = 0) {
|
|
37
|
-
*reinterpret_cast<uint16_t*>(this) = flags;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
inline uint16_t as_uint() const {
|
|
41
|
-
return *reinterpret_cast<const uint16_t*>(this);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
inline uint16_t category_flag() const {
|
|
45
|
-
return this->as_uint() & MASK_CATEGORIES;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
size_t unicode_len_utf8(char src);
|
|
50
|
-
|
|
51
|
-
std::string unicode_cpt_to_utf8 (uint32_t cpt);
|
|
52
|
-
uint32_t unicode_cpt_from_utf8(const std::string & utf8, size_t & offset);
|
|
53
|
-
|
|
54
|
-
std::vector<uint32_t> unicode_cpts_from_utf8(const std::string & utf8);
|
|
55
|
-
|
|
56
|
-
std::vector<uint32_t> unicode_cpts_normalize_nfd(const std::vector<uint32_t> & cpts);
|
|
57
|
-
|
|
58
|
-
unicode_cpt_flags unicode_cpt_flags_from_cpt (uint32_t cpt);
|
|
59
|
-
unicode_cpt_flags unicode_cpt_flags_from_utf8(const std::string & utf8);
|
|
60
|
-
|
|
61
|
-
std::string unicode_byte_to_utf8(uint8_t byte);
|
|
62
|
-
uint8_t unicode_utf8_to_byte(const std::string & utf8);
|
|
63
|
-
|
|
64
|
-
uint32_t unicode_tolower(uint32_t cpt);
|
|
65
|
-
|
|
66
|
-
std::vector<std::string> unicode_regex_split(const std::string & text, const std::vector<std::string> & regex_exprs);
|
|
Binary file
|
|
Binary file
|
package/ios/cactus.xcframework/tvos-arm64_x86_64-simulator/cactus.framework/ggml-llama-sim.metallib
DELETED
|
Binary file
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _default = exports.default = _reactNative.TurboModuleRegistry.get('Cactus');
|
|
9
|
-
//# sourceMappingURL=NativeCactus.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeCactus.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAkD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GA2TnCC,gCAAmB,CAACC,GAAG,CAAO,QAAQ,CAAC","ignoreList":[]}
|
package/lib/commonjs/agent.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CactusAgent = void 0;
|
|
7
|
-
var _lm = require("./lm");
|
|
8
|
-
var _tools = require("./tools");
|
|
9
|
-
class CactusAgent extends _lm.CactusLM {
|
|
10
|
-
static async init(params, onProgress, cactusToken, retryOptions) {
|
|
11
|
-
const result = await _lm.CactusLM.init(params, onProgress, cactusToken, retryOptions);
|
|
12
|
-
if (result.error || !result.lm) {
|
|
13
|
-
return {
|
|
14
|
-
agent: null,
|
|
15
|
-
error: result.error,
|
|
16
|
-
lm: null
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
const agent = Object.setPrototypeOf(result.lm, CactusAgent.prototype);
|
|
20
|
-
agent.tools = new _tools.Tools();
|
|
21
|
-
return {
|
|
22
|
-
agent,
|
|
23
|
-
error: null,
|
|
24
|
-
lm: agent
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
addTool(func, description, parameters) {
|
|
28
|
-
return this.tools.add(func, description, parameters);
|
|
29
|
-
}
|
|
30
|
-
getTools() {
|
|
31
|
-
return this.tools;
|
|
32
|
-
}
|
|
33
|
-
async completionWithTools(messages, params = {}, callback, recursionCount = 0, recursionLimit = 3) {
|
|
34
|
-
const tools = params.tools || this.tools;
|
|
35
|
-
if (!messages?.length) {
|
|
36
|
-
return this.completion([], params, callback);
|
|
37
|
-
}
|
|
38
|
-
if (!tools || tools.getSchemas().length === 0) {
|
|
39
|
-
return this.completion(messages, params, callback);
|
|
40
|
-
}
|
|
41
|
-
if (recursionCount >= recursionLimit) {
|
|
42
|
-
return this.completion(messages, {
|
|
43
|
-
...params,
|
|
44
|
-
jinja: true,
|
|
45
|
-
tools: tools.getSchemas()
|
|
46
|
-
}, callback);
|
|
47
|
-
}
|
|
48
|
-
const {
|
|
49
|
-
newMessages,
|
|
50
|
-
requiresReset
|
|
51
|
-
} = this.conversationHistoryManager.processNewMessages(messages);
|
|
52
|
-
if (requiresReset) {
|
|
53
|
-
this.context?.rewind();
|
|
54
|
-
this.conversationHistoryManager.reset();
|
|
55
|
-
}
|
|
56
|
-
const result = await this.context.completionWithTools({
|
|
57
|
-
...params,
|
|
58
|
-
messages: newMessages.length > 0 ? newMessages : messages,
|
|
59
|
-
tools: tools
|
|
60
|
-
}, callback, recursionCount, recursionLimit);
|
|
61
|
-
this.conversationHistoryManager.update(newMessages.length > 0 ? newMessages : messages, {
|
|
62
|
-
role: 'assistant',
|
|
63
|
-
content: result.content,
|
|
64
|
-
tool_calls: result.tool_calls
|
|
65
|
-
});
|
|
66
|
-
return result;
|
|
67
|
-
}
|
|
68
|
-
isJinjaSupported() {
|
|
69
|
-
return this.context.isJinjaSupported();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.CactusAgent = CactusAgent;
|
|
73
|
-
//# sourceMappingURL=agent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_lm","require","_tools","CactusAgent","CactusLM","init","params","onProgress","cactusToken","retryOptions","result","error","lm","agent","Object","setPrototypeOf","prototype","tools","Tools","addTool","func","description","parameters","add","getTools","completionWithTools","messages","callback","recursionCount","recursionLimit","length","completion","getSchemas","jinja","newMessages","requiresReset","conversationHistoryManager","processNewMessages","context","rewind","reset","update","role","content","tool_calls","isJinjaSupported","exports"],"sourceRoot":"../../src","sources":["agent.ts"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAUA,IAAAC,MAAA,GAAAD,OAAA;AAkBO,MAAME,WAAW,SAASC,YAAQ,CAAC;EAGxC,aAAaC,IAAIA,CACfC,MAAqB,EACrBC,UAAuC,EACvCC,WAAoB,EACpBC,YAAwD,EAC5B;IAC5B,MAAMC,MAAM,GAAG,MAAMN,YAAQ,CAACC,IAAI,CAACC,MAAM,EAAEC,UAAU,EAAEC,WAAW,EAAEC,YAAY,CAAC;IAEjF,IAAIC,MAAM,CAACC,KAAK,IAAI,CAACD,MAAM,CAACE,EAAE,EAAE;MAC9B,OAAO;QAAEC,KAAK,EAAE,IAAI;QAAEF,KAAK,EAAED,MAAM,CAACC,KAAK;QAAEC,EAAE,EAAE;MAAK,CAAC;IACvD;IAEA,MAAMC,KAAK,GAAGC,MAAM,CAACC,cAAc,CAACL,MAAM,CAACE,EAAE,EAAET,WAAW,CAACa,SAAS,CAAgB;IACpFH,KAAK,CAACI,KAAK,GAAG,IAAIC,YAAK,CAAC,CAAC;IACzB,OAAO;MAAEL,KAAK;MAAEF,KAAK,EAAE,IAAI;MAAEC,EAAE,EAAEC;IAAM,CAAC;EAC1C;EAEAM,OAAOA,CACLC,IAAc,EACdC,WAAmB,EACnBC,UAAwC,EAC9B;IACV,OAAO,IAAI,CAACL,KAAK,CAACM,GAAG,CAACH,IAAI,EAAEC,WAAW,EAAEC,UAAU,CAAC;EACtD;EAEAE,QAAQA,CAAA,EAAU;IAChB,OAAO,IAAI,CAACP,KAAK;EACnB;EAEA,MAAMQ,mBAAmBA,CACvBC,QAAsC,EACtCpB,MAA6B,GAAG,CAAC,CAAC,EAClCqB,QAAoC,EACpCC,cAAsB,GAAG,CAAC,EAC1BC,cAAsB,GAAG,CAAC,EACO;IACjC,MAAMZ,KAAK,GAAGX,MAAM,CAACW,KAAK,IAAI,IAAI,CAACA,KAAK;IAExC,IAAI,CAACS,QAAQ,EAAEI,MAAM,EAAE;MACrB,OAAO,IAAI,CAACC,UAAU,CAAC,EAAE,EAAEzB,MAAM,EAAEqB,QAAQ,CAAC;IAC9C;IACA,IAAI,CAACV,KAAK,IAAIA,KAAK,CAACe,UAAU,CAAC,CAAC,CAACF,MAAM,KAAK,CAAC,EAAE;MAC7C,OAAO,IAAI,CAACC,UAAU,CAACL,QAAQ,EAAEpB,MAAM,EAAEqB,QAAQ,CAAC;IACpD;IACA,IAAIC,cAAc,IAAIC,cAAc,EAAE;MACpC,OAAO,IAAI,CAACE,UAAU,CAACL,QAAQ,EAAE;QAC/B,GAAGpB,MAAM;QACT2B,KAAK,EAAE,IAAI;QACXhB,KAAK,EAAEA,KAAK,CAACe,UAAU,CAAC;MAC1B,CAAC,EAAEL,QAAQ,CAAC;IACd;IAEA,MAAM;MAAEO,WAAW;MAAEC;IAAc,CAAC,GAClC,IAAI,CAACC,0BAA0B,CAACC,kBAAkB,CAACX,QAAQ,CAAC;IAE9D,IAAIS,aAAa,EAAE;MACjB,IAAI,CAACG,OAAO,EAAEC,MAAM,CAAC,CAAC;MACtB,IAAI,CAACH,0BAA0B,CAACI,KAAK,CAAC,CAAC;IACzC;IAEA,MAAM9B,MAAM,GAAG,MAAM,IAAI,CAAC4B,OAAO,CAACb,mBAAmB,CAAC;MACpD,GAAGnB,MAAM;MACToB,QAAQ,EAAEQ,WAAW,CAACJ,MAAM,GAAG,CAAC,GAAGI,WAAW,GAAGR,QAAQ;MACzDT,KAAK,EAAEA;IACT,CAAC,EAAEU,QAAQ,EAAEC,cAAc,EAAEC,cAAc,CAAC;IAE5C,IAAI,CAACO,0BAA0B,CAACK,MAAM,CACpCP,WAAW,CAACJ,MAAM,GAAG,CAAC,GAAGI,WAAW,GAAGR,QAAQ,EAC/C;MACEgB,IAAI,EAAE,WAAW;MACjBC,OAAO,EAAEjC,MAAM,CAACiC,OAAO;MACvBC,UAAU,EAAElC,MAAM,CAACkC;IACrB,CACF,CAAC;IAED,OAAOlC,MAAM;EACf;EACAmC,gBAAgBA,CAAA,EAAY;IAC1B,OAAO,IAAI,CAACP,OAAO,CAACO,gBAAgB,CAAC,CAAC;EACxC;AACF;AAACC,OAAA,CAAA3C,WAAA,GAAAA,WAAA","ignoreList":[]}
|
package/lib/commonjs/chat.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ConversationHistoryManager = void 0;
|
|
7
|
-
exports.formatChat = formatChat;
|
|
8
|
-
function formatChat(messages) {
|
|
9
|
-
const chat = [];
|
|
10
|
-
messages.forEach(currMsg => {
|
|
11
|
-
const role = currMsg.role || '';
|
|
12
|
-
let content = '';
|
|
13
|
-
if ('content' in currMsg) {
|
|
14
|
-
if (typeof currMsg.content === 'string') {
|
|
15
|
-
;
|
|
16
|
-
({
|
|
17
|
-
content
|
|
18
|
-
} = currMsg);
|
|
19
|
-
} else if (Array.isArray(currMsg.content)) {
|
|
20
|
-
currMsg.content.forEach(part => {
|
|
21
|
-
if ('text' in part) {
|
|
22
|
-
content += `${content ? '\n' : ''}${part.text}`;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
} else {
|
|
26
|
-
throw new TypeError("Invalid 'content' type (ref: https://github.com/ggerganov/llama.cpp/issues/8367)");
|
|
27
|
-
}
|
|
28
|
-
} else {
|
|
29
|
-
throw new Error("Missing 'content' (ref: https://github.com/ggerganov/llama.cpp/issues/8367)");
|
|
30
|
-
}
|
|
31
|
-
chat.push({
|
|
32
|
-
role,
|
|
33
|
-
content
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
return chat;
|
|
37
|
-
}
|
|
38
|
-
class ConversationHistoryManager {
|
|
39
|
-
history = [];
|
|
40
|
-
processNewMessages(fullMessageHistory) {
|
|
41
|
-
let divergent = fullMessageHistory.length < this.history.length;
|
|
42
|
-
if (!divergent) {
|
|
43
|
-
for (let i = 0; i < this.history.length; i++) {
|
|
44
|
-
if (JSON.stringify(this.history[i]) !== JSON.stringify(fullMessageHistory[i])) {
|
|
45
|
-
divergent = true;
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (divergent) {
|
|
51
|
-
return {
|
|
52
|
-
newMessages: fullMessageHistory,
|
|
53
|
-
requiresReset: true
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
const newMessages = fullMessageHistory.slice(this.history.length);
|
|
57
|
-
return {
|
|
58
|
-
newMessages,
|
|
59
|
-
requiresReset: false
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
update(newMessages, assistantResponse) {
|
|
63
|
-
this.history.push(...newMessages, assistantResponse);
|
|
64
|
-
}
|
|
65
|
-
reset() {
|
|
66
|
-
this.history = [];
|
|
67
|
-
}
|
|
68
|
-
getMessages() {
|
|
69
|
-
return this.history;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
exports.ConversationHistoryManager = ConversationHistoryManager;
|
|
73
|
-
//# sourceMappingURL=chat.js.map
|
package/lib/commonjs/chat.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["formatChat","messages","chat","forEach","currMsg","role","content","Array","isArray","part","text","TypeError","Error","push","ConversationHistoryManager","history","processNewMessages","fullMessageHistory","divergent","length","i","JSON","stringify","newMessages","requiresReset","slice","update","assistantResponse","reset","getMessages","exports"],"sourceRoot":"../../src","sources":["chat.ts"],"mappings":";;;;;;;AAaO,SAASA,UAAUA,CACxBC,QAAsC,EACZ;EAC1B,MAAMC,IAA8B,GAAG,EAAE;EAEzCD,QAAQ,CAACE,OAAO,CAAEC,OAAO,IAAK;IAC5B,MAAMC,IAAY,GAAGD,OAAO,CAACC,IAAI,IAAI,EAAE;IAEvC,IAAIC,OAAe,GAAG,EAAE;IACxB,IAAI,SAAS,IAAIF,OAAO,EAAE;MACxB,IAAI,OAAOA,OAAO,CAACE,OAAO,KAAK,QAAQ,EAAE;QACvC;QAAC,CAAC;UAAEA;QAAQ,CAAC,GAAGF,OAAO;MACzB,CAAC,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,OAAO,CAACE,OAAO,CAAC,EAAE;QACzCF,OAAO,CAACE,OAAO,CAACH,OAAO,CAAEM,IAAI,IAAK;UAChC,IAAI,MAAM,IAAIA,IAAI,EAAE;YAClBH,OAAO,IAAI,GAAGA,OAAO,GAAG,IAAI,GAAG,EAAE,GAAGG,IAAI,CAACC,IAAI,EAAE;UACjD;QACF,CAAC,CAAC;MACJ,CAAC,MAAM;QACL,MAAM,IAAIC,SAAS,CACjB,kFACF,CAAC;MACH;IACF,CAAC,MAAM;MACL,MAAM,IAAIC,KAAK,CACb,6EACF,CAAC;IACH;IAEAV,IAAI,CAACW,IAAI,CAAC;MAAER,IAAI;MAAEC;IAAQ,CAAC,CAAC;EAC9B,CAAC,CAAC;EACF,OAAOJ,IAAI;AACb;AAOO,MAAMY,0BAA0B,CAAC;EAC9BC,OAAO,GAAiC,EAAE;EAE3CC,kBAAkBA,CACvBC,kBAAgD,EAC7B;IACnB,IAAIC,SAAS,GAAGD,kBAAkB,CAACE,MAAM,GAAG,IAAI,CAACJ,OAAO,CAACI,MAAM;IAC/D,IAAI,CAACD,SAAS,EAAE;MACd,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,IAAI,CAACL,OAAO,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;QAC5C,IAAIC,IAAI,CAACC,SAAS,CAAC,IAAI,CAACP,OAAO,CAACK,CAAC,CAAC,CAAC,KAAKC,IAAI,CAACC,SAAS,CAACL,kBAAkB,CAACG,CAAC,CAAC,CAAC,EAAE;UAC7EF,SAAS,GAAG,IAAI;UAChB;QACF;MACF;IACF;IAEA,IAAIA,SAAS,EAAE;MACb,OAAO;QAAEK,WAAW,EAAEN,kBAAkB;QAAEO,aAAa,EAAE;MAAK,CAAC;IACjE;IAEA,MAAMD,WAAW,GAAGN,kBAAkB,CAACQ,KAAK,CAAC,IAAI,CAACV,OAAO,CAACI,MAAM,CAAC;IACjE,OAAO;MAAEI,WAAW;MAAEC,aAAa,EAAE;IAAM,CAAC;EAC9C;EAEOE,MAAMA,CACXH,WAAyC,EACzCI,iBAA6C,EAC7C;IACA,IAAI,CAACZ,OAAO,CAACF,IAAI,CAAC,GAAGU,WAAW,EAAEI,iBAAiB,CAAC;EACtD;EAEOC,KAAKA,CAAA,EAAG;IACb,IAAI,CAACb,OAAO,GAAG,EAAE;EACnB;EAEOc,WAAWA,CAAA,EAAiC;IACjD,OAAO,IAAI,CAACd,OAAO;EACrB;AACF;AAACe,OAAA,CAAAhB,0BAAA,GAAAA,0BAAA","ignoreList":[]}
|