@qvac/sdk 0.8.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -1
- package/README.md +191 -373
- package/dist/client/api/cancel.d.ts +4 -22
- package/dist/client/api/cancel.js +6 -25
- package/dist/client/api/completion-stream.d.ts +30 -24
- package/dist/client/api/completion-stream.js +70 -121
- package/dist/client/api/delete-cache.js +2 -3
- package/dist/client/api/download-asset.d.ts +5 -6
- package/dist/client/api/download-asset.js +20 -16
- package/dist/client/api/embed.d.ts +4 -21
- package/dist/client/api/embed.js +14 -4
- package/dist/client/api/index.d.ts +2 -6
- package/dist/client/api/index.js +2 -6
- package/dist/client/api/load-model.d.ts +21 -49
- package/dist/client/api/load-model.js +134 -40
- package/dist/client/api/logging-stream.d.ts +4 -7
- package/dist/client/api/logging-stream.js +5 -9
- package/dist/client/api/ping.d.ts +11 -0
- package/dist/client/api/ping.js +18 -0
- package/dist/client/api/provide.d.ts +1 -1
- package/dist/client/api/provide.js +3 -4
- package/dist/client/api/rag.d.ts +21 -216
- package/dist/client/api/rag.js +36 -396
- package/dist/client/api/stop-provider.d.ts +1 -1
- package/dist/client/api/stop-provider.js +3 -4
- package/dist/client/api/text-to-speech.d.ts +2 -2
- package/dist/client/api/text-to-speech.js +3 -3
- package/dist/client/api/transcribe.d.ts +5 -9
- package/dist/client/api/transcribe.js +9 -11
- package/dist/client/api/translate.d.ts +3 -3
- package/dist/client/api/translate.js +15 -15
- package/dist/client/api/unload-model.d.ts +1 -5
- package/dist/client/api/unload-model.js +4 -17
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/logging-stream-registry.d.ts +1 -1
- package/dist/client/logging-stream-registry.js +13 -14
- package/dist/client/rpc/bare-client.d.ts +139 -3
- package/dist/client/rpc/bare-client.js +16 -117
- package/dist/client/rpc/bare-rpc-client.d.ts +4 -0
- package/dist/client/rpc/bare-rpc-client.js +87 -0
- package/dist/client/rpc/expo-rpc-client.d.ts +1 -2
- package/dist/client/rpc/expo-rpc-client.js +14 -57
- package/dist/client/rpc/node-rpc-client.d.ts +8 -3
- package/dist/client/rpc/node-rpc-client.js +62 -218
- package/dist/client/rpc/rpc-client.d.ts +2 -3
- package/dist/client/rpc/rpc-client.js +49 -184
- package/dist/constants/audio.d.ts +2 -1
- package/dist/constants/audio.js +17 -1
- package/dist/constants/index.d.ts +0 -1
- package/dist/constants/index.js +0 -1
- package/dist/examples/delegated-inference/consumer.js +2 -3
- package/dist/examples/download-with-cancel.js +4 -3
- package/dist/examples/embed-hyperdrive.d.ts +2 -0
- package/dist/examples/embed-hyperdrive.js +19 -0
- package/dist/examples/kv-cache-cleanup.js +2 -1
- package/dist/examples/kv-cache-custom-key.js +2 -16
- package/dist/examples/kv-cache-example.js +2 -1
- package/dist/examples/llamacpp-file-logging.d.ts +2 -0
- package/dist/examples/{logging-file-transport.js → llamacpp-file-logging.js} +8 -3
- package/dist/examples/llamacpp-filesystem.js +2 -2
- package/dist/examples/llamacpp-http.js +1 -0
- package/dist/examples/llamacpp-hyperdrive.d.ts +2 -0
- package/dist/examples/{llamacpp-p2p.js → llamacpp-hyperdrive.js} +2 -1
- package/dist/examples/llamacpp-multimodal.js +4 -3
- package/dist/examples/llamacpp-native-tools.js +30 -72
- package/dist/examples/multi-model-demo.js +3 -2
- package/dist/examples/parallel-download.js +14 -46
- package/dist/examples/rag/rag-chromadb.js +1 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.js +107 -0
- package/dist/examples/rag/rag-hyperdb.d.ts +2 -0
- package/dist/examples/rag/{rag-hyperdb/ingest.js → rag-hyperdb.js} +5 -10
- package/dist/examples/rag/rag-lancedb.js +1 -0
- package/dist/examples/rag/rag-sqlite.js +1 -0
- package/dist/examples/seed-hyperdrive.d.ts +2 -0
- package/dist/examples/text-to-speech.d.ts +3 -0
- package/dist/examples/{tts/utils.js → text-to-speech.js} +63 -18
- package/dist/examples/translation/translation-indic.js +1 -4
- package/dist/examples/translation/translation-llm-context.js +1 -0
- package/dist/examples/translation/translation-llm.js +2 -2
- package/dist/examples/translation/translation-opus.js +3 -6
- package/dist/examples/translation/translation-stream.js +3 -3
- package/dist/examples/whispercpp-filesystem.js +43 -0
- package/dist/examples/{transcription/whispercpp-microphone-record.js → whispercpp-microphone-record.js} +9 -8
- package/dist/expo/plugins/index.d.ts +0 -3
- package/dist/expo/plugins/index.js +0 -3
- package/dist/expo/plugins/withMobileBundle.d.ts +2 -5
- package/dist/expo/plugins/withMobileBundle.js +40 -121
- package/dist/expo/plugins/withQvacSDK.d.ts +0 -4
- package/dist/expo/plugins/withQvacSDK.js +1 -26
- package/dist/index.d.ts +4 -9
- package/dist/index.js +5 -11
- package/dist/logging/base-logger.js +16 -26
- package/dist/logging/index.d.ts +1 -7
- package/dist/logging/index.js +1 -7
- package/dist/logging/logger.d.ts +2 -0
- package/dist/logging/logger.js +6 -11
- package/dist/logging/stream-logger.d.ts +1 -1
- package/dist/logging/stream-logger.js +3 -6
- package/dist/logging/transport.js +2 -2
- package/dist/logging/types.d.ts +0 -2
- package/dist/logging/utils.d.ts +0 -2
- package/dist/logging/utils.js +0 -62
- package/dist/models/{registry → hyperdrive}/index.js +1 -1
- package/dist/models/hyperdrive/models.d.ts +619 -0
- package/dist/models/hyperdrive/models.js +693 -0
- package/dist/schemas/cancel.d.ts +0 -18
- package/dist/schemas/cancel.js +0 -7
- package/dist/schemas/common.d.ts +166 -3012
- package/dist/schemas/common.js +4 -27
- package/dist/schemas/completion-stream.d.ts +60 -31
- package/dist/schemas/completion-stream.js +44 -20
- package/dist/schemas/delegate.d.ts +0 -9
- package/dist/schemas/delegate.js +2 -6
- package/dist/schemas/download-asset.d.ts +3 -125
- package/dist/schemas/download-asset.js +5 -22
- package/dist/schemas/embed.d.ts +3 -3
- package/dist/schemas/embed.js +2 -9
- package/dist/schemas/index.d.ts +2 -20
- package/dist/schemas/index.js +2 -20
- package/dist/schemas/llamacpp-config.d.ts +12 -243
- package/dist/schemas/llamacpp-config.js +14 -50
- package/dist/schemas/load-model.d.ts +893 -14471
- package/dist/schemas/load-model.js +72 -325
- package/dist/schemas/logging-stream.d.ts +4 -11
- package/dist/schemas/logging-stream.js +3 -4
- package/dist/schemas/ping.d.ts +11 -0
- package/dist/schemas/ping.js +8 -0
- package/dist/schemas/rag.d.ts +52 -183
- package/dist/schemas/rag.js +23 -152
- package/dist/schemas/text-to-speech.d.ts +1 -692
- package/dist/schemas/text-to-speech.js +3 -35
- package/dist/schemas/transcription.d.ts +0 -3
- package/dist/schemas/transcription.js +0 -1
- package/dist/schemas/translate.d.ts +23 -68
- package/dist/schemas/translate.js +11 -37
- package/dist/schemas/translation-config.d.ts +7 -810
- package/dist/schemas/translation-config.js +7 -113
- package/dist/schemas/unload-model.d.ts +0 -2
- package/dist/schemas/unload-model.js +0 -2
- package/dist/schemas/whispercpp-config.d.ts +25 -0
- package/dist/schemas/whispercpp-config.js +18 -0
- package/dist/server/bare/{ops → addons}/cancel.js +1 -2
- package/dist/server/bare/addons/index.d.ts +4 -0
- package/dist/server/bare/addons/index.js +3 -0
- package/dist/server/bare/addons/llamacpp/create-model.d.ts +5 -0
- package/dist/server/bare/addons/llamacpp/create-model.js +67 -0
- package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.d.ts +1 -2
- package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.js +87 -54
- package/dist/server/bare/addons/llamacpp/handlers/embed.d.ts +4 -0
- package/dist/server/bare/{ops → addons/llamacpp/handlers}/embed.js +7 -22
- package/dist/server/bare/addons/llamacpp/index.d.ts +4 -0
- package/dist/server/bare/addons/llamacpp/index.js +3 -0
- package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.d.ts +1 -4
- package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.js +19 -54
- package/dist/server/bare/addons/load-model.d.ts +3 -0
- package/dist/server/bare/addons/load-model.js +62 -0
- package/dist/server/bare/addons/translation/create-model.d.ts +4 -0
- package/dist/server/bare/addons/translation/create-model.js +45 -0
- package/dist/server/bare/addons/translation/handlers/translate.d.ts +3 -0
- package/dist/server/bare/{ops → addons/translation/handlers}/translate.js +14 -47
- package/dist/server/bare/addons/translation/index.d.ts +3 -0
- package/dist/server/bare/addons/translation/index.js +2 -0
- package/dist/server/bare/addons/tts/create-model.d.ts +6 -0
- package/dist/server/bare/addons/tts/create-model.js +40 -0
- package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.js +3 -25
- package/dist/server/bare/addons/tts/index.d.ts +3 -0
- package/dist/server/bare/addons/tts/index.js +2 -0
- package/dist/server/bare/addons/unload-model.js +20 -0
- package/dist/server/bare/addons/whispercpp/create-model.d.ts +6 -0
- package/dist/server/bare/addons/whispercpp/create-model.js +55 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +48 -0
- package/dist/server/bare/addons/whispercpp/index.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/index.js +2 -0
- package/dist/server/bare/delegate-rpc-client.d.ts +0 -6
- package/dist/server/bare/delegate-rpc-client.js +45 -187
- package/dist/server/bare/hyperswarm.d.ts +0 -3
- package/dist/server/bare/hyperswarm.js +6 -29
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +10 -9
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +4 -7
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +14 -13
- package/dist/server/bare/rag-hyperdb/handlers/search.js +10 -10
- package/dist/server/bare/rag-hyperdb/index.d.ts +1 -8
- package/dist/server/bare/rag-hyperdb/index.js +1 -8
- package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +5 -0
- package/dist/server/bare/rag-hyperdb/rag-manager.js +65 -0
- package/dist/server/bare/registry/logging-stream-registry.d.ts +7 -24
- package/dist/server/bare/registry/logging-stream-registry.js +20 -99
- package/dist/server/bare/registry/model-registry.d.ts +26 -16
- package/dist/server/bare/registry/model-registry.js +13 -34
- package/dist/server/error-handlers.d.ts +2 -3
- package/dist/server/error-handlers.js +10 -15
- package/dist/server/http-server.d.ts +2 -0
- package/dist/server/http-server.js +189 -0
- package/dist/server/rpc/create-server.js +3 -5
- package/dist/server/rpc/handle-request.d.ts +9 -0
- package/dist/server/rpc/handle-request.js +242 -92
- package/dist/server/rpc/handlers/cancelHandler.js +3 -14
- package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +1 -3
- package/dist/server/rpc/handlers/completion-stream-delegated.js +8 -20
- package/dist/server/rpc/handlers/completion-stream.js +41 -2
- package/dist/server/rpc/handlers/delete-cache.js +2 -4
- package/dist/server/rpc/handlers/download-asset.js +6 -59
- package/dist/server/rpc/handlers/embed.js +19 -2
- package/dist/server/rpc/handlers/index.d.ts +0 -13
- package/dist/server/rpc/handlers/index.js +0 -13
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +11 -12
- package/dist/server/rpc/handlers/load-model/download-manager.js +28 -43
- package/dist/server/rpc/handlers/load-model/http.d.ts +1 -2
- package/dist/server/rpc/handlers/load-model/http.js +55 -424
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +1 -2
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +171 -364
- package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
- package/dist/server/rpc/handlers/load-model/index.js +2 -2
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +1 -3
- package/dist/server/rpc/handlers/load-model/resolve.js +29 -110
- package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -6
- package/dist/server/rpc/handlers/load-model-delegated.js +20 -60
- package/dist/server/rpc/handlers/{load-model/handler.d.ts → load-model.d.ts} +2 -2
- package/dist/server/rpc/handlers/load-model.js +57 -0
- package/dist/server/rpc/handlers/logging-stream.js +4 -4
- package/dist/server/rpc/handlers/provideHandler/connection.js +10 -12
- package/dist/server/rpc/handlers/provideHandler/handler.js +17 -20
- package/dist/server/rpc/handlers/provideHandler/proxy.js +6 -8
- package/dist/server/rpc/handlers/rag.d.ts +2 -2
- package/dist/server/rpc/handlers/rag.js +43 -130
- package/dist/server/rpc/handlers/stopProvideHandler.js +2 -6
- package/dist/server/rpc/handlers/text-to-speech.js +5 -2
- package/dist/server/rpc/handlers/transcribe-stream.js +24 -2
- package/dist/server/rpc/handlers/translate.js +49 -2
- package/dist/server/rpc/handlers/unload-model.js +3 -12
- package/dist/server/rpc/index.d.ts +1 -1
- package/dist/server/utils/audio/decoder.d.ts +1 -2
- package/dist/server/utils/audio/decoder.js +12 -49
- package/dist/server/utils/cache.d.ts +8 -19
- package/dist/server/utils/cache.js +15 -100
- package/dist/server/utils/hash.d.ts +5 -0
- package/dist/server/utils/hash.js +11 -0
- package/dist/server/utils/index.d.ts +2 -7
- package/dist/server/utils/index.js +2 -7
- package/dist/server/utils/tool-parser.js +14 -28
- package/dist/server/worker.d.ts +5 -4
- package/dist/server/worker.js +89 -22
- package/package.json +41 -148
- package/NOTICE +0 -695
- package/bare-imports.json +0 -44
- package/dist/client/api/get-model-info.d.ts +0 -36
- package/dist/client/api/get-model-info.js +0 -14
- package/dist/client/api/heartbeat.d.ts +0 -30
- package/dist/client/api/heartbeat.js +0 -38
- package/dist/client/api/invoke-plugin.d.ts +0 -15
- package/dist/client/api/invoke-plugin.js +0 -38
- package/dist/client/api/ocr.d.ts +0 -31
- package/dist/client/api/ocr.js +0 -88
- package/dist/client/api/registry.d.ts +0 -14
- package/dist/client/api/registry.js +0 -37
- package/dist/client/config-loader/config-utils.d.ts +0 -5
- package/dist/client/config-loader/config-utils.js +0 -20
- package/dist/client/config-loader/resolve-config.bare.d.ts +0 -9
- package/dist/client/config-loader/resolve-config.bare.js +0 -87
- package/dist/client/config-loader/resolve-config.expo.d.ts +0 -11
- package/dist/client/config-loader/resolve-config.expo.js +0 -62
- package/dist/client/config-loader/resolve-config.node.d.ts +0 -10
- package/dist/client/config-loader/resolve-config.node.js +0 -145
- package/dist/client/init-hooks.d.ts +0 -21
- package/dist/client/init-hooks.js +0 -66
- package/dist/client/rpc/expo-device-info.d.ts +0 -6
- package/dist/client/rpc/expo-device-info.js +0 -32
- package/dist/client/rpc/profiling/index.d.ts +0 -2
- package/dist/client/rpc/profiling/index.js +0 -1
- package/dist/client/rpc/profiling/profiler.d.ts +0 -27
- package/dist/client/rpc/profiling/profiler.js +0 -139
- package/dist/constants/registry.d.ts +0 -2
- package/dist/constants/registry.js +0 -1
- package/dist/examples/cache-management.d.ts +0 -2
- package/dist/examples/cache-management.js +0 -97
- package/dist/examples/config/blind-relay/blind-relay.config.d.ts +0 -5
- package/dist/examples/config/blind-relay/blind-relay.config.js +0 -7
- package/dist/examples/config/default/default.config.d.ts +0 -8
- package/dist/examples/config/default/default.config.js +0 -6
- package/dist/examples/config/plugins/plugins.config.d.ts +0 -5
- package/dist/examples/config/plugins/plugins.config.js +0 -4
- package/dist/examples/config-reload.d.ts +0 -2
- package/dist/examples/config-reload.js +0 -49
- package/dist/examples/default-config-usage.d.ts +0 -17
- package/dist/examples/default-config-usage.js +0 -47
- package/dist/examples/delegated-inference/consumer-profiled.d.ts +0 -2
- package/dist/examples/delegated-inference/consumer-profiled.js +0 -67
- package/dist/examples/download-with-blind-relays.d.ts +0 -2
- package/dist/examples/download-with-blind-relays.js +0 -49
- package/dist/examples/embed-p2p.d.ts +0 -2
- package/dist/examples/embed-p2p.js +0 -54
- package/dist/examples/llamacpp-p2p.d.ts +0 -2
- package/dist/examples/llamacpp-sharded.d.ts +0 -2
- package/dist/examples/llamacpp-sharded.js +0 -53
- package/dist/examples/logging-file-transport.d.ts +0 -2
- package/dist/examples/logging-streaming.d.ts +0 -2
- package/dist/examples/logging-streaming.js +0 -75
- package/dist/examples/mcp-websearch.d.ts +0 -13
- package/dist/examples/mcp-websearch.js +0 -176
- package/dist/examples/ocr-fasttext.d.ts +0 -2
- package/dist/examples/ocr-fasttext.js +0 -52
- package/dist/examples/plugins.d.ts +0 -14
- package/dist/examples/plugins.js +0 -129
- package/dist/examples/profiling/basic.d.ts +0 -2
- package/dist/examples/profiling/basic.js +0 -71
- package/dist/examples/profiling/per-call.d.ts +0 -2
- package/dist/examples/profiling/per-call.js +0 -30
- package/dist/examples/quickstart.d.ts +0 -2
- package/dist/examples/quickstart.js +0 -28
- package/dist/examples/rag/rag-hyperdb/cancellation.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -75
- package/dist/examples/rag/rag-hyperdb/ingest.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/pipeline.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -74
- package/dist/examples/rag/rag-hyperdb/workspaces.d.ts +0 -2
- package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -178
- package/dist/examples/registry-query.d.ts +0 -2
- package/dist/examples/registry-query.js +0 -87
- package/dist/examples/seed-p2p.d.ts +0 -2
- package/dist/examples/transcription/parakeet-ctc-filesystem.d.ts +0 -2
- package/dist/examples/transcription/parakeet-ctc-filesystem.js +0 -40
- package/dist/examples/transcription/parakeet-microphone-record.d.ts +0 -2
- package/dist/examples/transcription/parakeet-microphone-record.js +0 -95
- package/dist/examples/transcription/parakeet-sortformer.d.ts +0 -2
- package/dist/examples/transcription/parakeet-sortformer.js +0 -115
- package/dist/examples/transcription/parakeet-tdt-filesystem.d.ts +0 -2
- package/dist/examples/transcription/parakeet-tdt-filesystem.js +0 -44
- package/dist/examples/transcription/whispercpp-filesystem.js +0 -69
- package/dist/examples/transcription/whispercpp-prompt.d.ts +0 -2
- package/dist/examples/transcription/whispercpp-prompt.js +0 -67
- package/dist/examples/translation/translation-bergamot-batch.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot-batch.js +0 -49
- package/dist/examples/translation/translation-bergamot-pivot.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot-pivot.js +0 -73
- package/dist/examples/translation/translation-bergamot.d.ts +0 -2
- package/dist/examples/translation/translation-bergamot.js +0 -39
- package/dist/examples/translation/translation-llm-afriquegemma.d.ts +0 -2
- package/dist/examples/translation/translation-llm-afriquegemma.js +0 -39
- package/dist/examples/tts/chatterbox.d.ts +0 -2
- package/dist/examples/tts/chatterbox.js +0 -59
- package/dist/examples/tts/supertonic.d.ts +0 -2
- package/dist/examples/tts/supertonic.js +0 -51
- package/dist/examples/tts/utils.d.ts +0 -17
- package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +0 -15
- package/dist/expo/plugins/resolve-sdk-package-dir.js +0 -31
- package/dist/expo/plugins/withAndroidArchitecture.d.ts +0 -8
- package/dist/expo/plugins/withAndroidArchitecture.js +0 -52
- package/dist/expo/plugins/withAndroidNdkVersion.d.ts +0 -8
- package/dist/expo/plugins/withAndroidNdkVersion.js +0 -31
- package/dist/expo/plugins/withDeviceInfo.d.ts +0 -10
- package/dist/expo/plugins/withDeviceInfo.js +0 -48
- package/dist/logging/addon.d.ts +0 -6
- package/dist/logging/addon.js +0 -75
- package/dist/logging/client-logger.d.ts +0 -3
- package/dist/logging/client-logger.js +0 -24
- package/dist/logging/namespaces.d.ts +0 -6
- package/dist/logging/namespaces.js +0 -6
- package/dist/logging/registry.d.ts +0 -31
- package/dist/logging/registry.js +0 -62
- package/dist/logging/server-logger.d.ts +0 -3
- package/dist/logging/server-logger.js +0 -16
- package/dist/models/registry/models.d.ts +0 -10417
- package/dist/models/registry/models.js +0 -10757
- package/dist/models/update-models/codegen.d.ts +0 -3
- package/dist/models/update-models/codegen.js +0 -135
- package/dist/models/update-models/history.d.ts +0 -24
- package/dist/models/update-models/history.js +0 -107
- package/dist/models/update-models/index.d.ts +0 -2
- package/dist/models/update-models/index.js +0 -125
- package/dist/models/update-models/naming.d.ts +0 -4
- package/dist/models/update-models/naming.js +0 -370
- package/dist/models/update-models/processing.d.ts +0 -8
- package/dist/models/update-models/processing.js +0 -67
- package/dist/models/update-models/registry.d.ts +0 -4
- package/dist/models/update-models/registry.js +0 -67
- package/dist/models/update-models/shards.d.ts +0 -4
- package/dist/models/update-models/shards.js +0 -57
- package/dist/models/update-models/types.d.ts +0 -60
- package/dist/models/update-models/types.js +0 -1
- package/dist/models/update-models/utils.d.ts +0 -3
- package/dist/models/update-models/utils.js +0 -21
- package/dist/pear/pre.d.ts +0 -18
- package/dist/pear/pre.js +0 -433
- package/dist/profiling/aggregator.d.ts +0 -15
- package/dist/profiling/aggregator.js +0 -100
- package/dist/profiling/clock.d.ts +0 -12
- package/dist/profiling/clock.js +0 -51
- package/dist/profiling/controller.d.ts +0 -33
- package/dist/profiling/controller.js +0 -123
- package/dist/profiling/envelope.d.ts +0 -10
- package/dist/profiling/envelope.js +0 -36
- package/dist/profiling/events.d.ts +0 -20
- package/dist/profiling/events.js +0 -37
- package/dist/profiling/exporters.d.ts +0 -10
- package/dist/profiling/exporters.js +0 -236
- package/dist/profiling/index.d.ts +0 -36
- package/dist/profiling/index.js +0 -31
- package/dist/profiling/ring-buffer.d.ts +0 -19
- package/dist/profiling/ring-buffer.js +0 -83
- package/dist/profiling/types.d.ts +0 -47
- package/dist/profiling/types.js +0 -1
- package/dist/schemas/archive.d.ts +0 -9
- package/dist/schemas/archive.js +0 -17
- package/dist/schemas/engine-addon-map.d.ts +0 -5
- package/dist/schemas/engine-addon-map.js +0 -52
- package/dist/schemas/get-model-info.d.ts +0 -120
- package/dist/schemas/get-model-info.js +0 -58
- package/dist/schemas/heartbeat.d.ts +0 -17
- package/dist/schemas/heartbeat.js +0 -10
- package/dist/schemas/json-schema.d.ts +0 -16
- package/dist/schemas/json-schema.js +0 -2
- package/dist/schemas/mcp-adapter.d.ts +0 -47
- package/dist/schemas/mcp-adapter.js +0 -1
- package/dist/schemas/model-src-utils.d.ts +0 -148
- package/dist/schemas/model-src-utils.js +0 -35
- package/dist/schemas/model-types.d.ts +0 -183
- package/dist/schemas/model-types.js +0 -168
- package/dist/schemas/ocr.d.ts +0 -125
- package/dist/schemas/ocr.js +0 -57
- package/dist/schemas/path-validation.d.ts +0 -10
- package/dist/schemas/path-validation.js +0 -22
- package/dist/schemas/plugin.d.ts +0 -226
- package/dist/schemas/plugin.js +0 -158
- package/dist/schemas/profiling.d.ts +0 -105
- package/dist/schemas/profiling.js +0 -66
- package/dist/schemas/registry.d.ts +0 -356
- package/dist/schemas/registry.js +0 -93
- package/dist/schemas/reload-config.d.ts +0 -476
- package/dist/schemas/reload-config.js +0 -44
- package/dist/schemas/runtime-context.d.ts +0 -19
- package/dist/schemas/runtime-context.js +0 -7
- package/dist/schemas/sdk-config.d.ts +0 -2973
- package/dist/schemas/sdk-config.js +0 -136
- package/dist/schemas/sdk-errors-client.d.ts +0 -31
- package/dist/schemas/sdk-errors-client.js +0 -143
- package/dist/schemas/sdk-errors-registry.d.ts +0 -6
- package/dist/schemas/sdk-errors-registry.js +0 -8
- package/dist/schemas/sdk-errors-server.d.ts +0 -89
- package/dist/schemas/sdk-errors-server.js +0 -451
- package/dist/schemas/shard.d.ts +0 -21
- package/dist/schemas/shard.js +0 -17
- package/dist/schemas/tools.d.ts +0 -65
- package/dist/schemas/tools.js +0 -43
- package/dist/schemas/transcription-config.d.ts +0 -383
- package/dist/schemas/transcription-config.js +0 -95
- package/dist/scripts/run-security-tests-bare.d.ts +0 -2
- package/dist/scripts/run-security-tests-bare.js +0 -78
- package/dist/scripts/run-security-tests.d.ts +0 -2
- package/dist/scripts/run-security-tests.js +0 -22
- package/dist/scripts/run-unit-tests.d.ts +0 -2
- package/dist/scripts/run-unit-tests.js +0 -17
- package/dist/server/bare/ops/embed.d.ts +0 -12
- package/dist/server/bare/ops/load-model.d.ts +0 -9
- package/dist/server/bare/ops/load-model.js +0 -85
- package/dist/server/bare/ops/transcribe.d.ts +0 -3
- package/dist/server/bare/ops/transcribe.js +0 -75
- package/dist/server/bare/ops/translate.d.ts +0 -5
- package/dist/server/bare/ops/unload-model.js +0 -41
- package/dist/server/bare/plugins/index.d.ts +0 -8
- package/dist/server/bare/plugins/index.js +0 -7
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +0 -6
- package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +0 -34
- package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +0 -220
- package/dist/server/bare/plugins/llamacpp-completion/plugin.js +0 -155
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +0 -54
- package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +0 -87
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +0 -367
- package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +0 -201
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.d.ts +0 -10
- package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.js +0 -110
- package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +0 -86
- package/dist/server/bare/plugins/onnx-ocr/plugin.js +0 -117
- package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -373
- package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -182
- package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
- package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
- package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +0 -317
- package/dist/server/bare/plugins/parakeet-transcription/plugin.js +0 -154
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +0 -237
- package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +0 -86
- package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/chunk.js +0 -7
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +0 -14
- package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/ingest.js +0 -18
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +0 -3
- package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +0 -4
- package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +0 -9
- package/dist/server/bare/rag-hyperdb/handlers/reindex.js +0 -16
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +0 -7
- package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +0 -39
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +0 -15
- package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +0 -136
- package/dist/server/bare/registry/config-registry.d.ts +0 -14
- package/dist/server/bare/registry/config-registry.js +0 -82
- package/dist/server/bare/registry/model-config-registry.d.ts +0 -4
- package/dist/server/bare/registry/model-config-registry.js +0 -15
- package/dist/server/bare/registry/model-config-utils.d.ts +0 -15
- package/dist/server/bare/registry/model-config-utils.js +0 -112
- package/dist/server/bare/registry/registry-client.d.ts +0 -5
- package/dist/server/bare/registry/registry-client.js +0 -37
- package/dist/server/bare/registry/runtime-context-registry.d.ts +0 -7
- package/dist/server/bare/registry/runtime-context-registry.js +0 -26
- package/dist/server/bare/utils/audio-input.d.ts +0 -10
- package/dist/server/bare/utils/audio-input.js +0 -33
- package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
- package/dist/server/bare/utils/loader-adapter.js +0 -9
- package/dist/server/env.d.ts +0 -22
- package/dist/server/env.js +0 -57
- package/dist/server/plugins/index.d.ts +0 -2
- package/dist/server/plugins/index.js +0 -1
- package/dist/server/plugins/registry.d.ts +0 -9
- package/dist/server/plugins/registry.js +0 -79
- package/dist/server/rpc/delegate-transport.d.ts +0 -19
- package/dist/server/rpc/delegate-transport.js +0 -236
- package/dist/server/rpc/delegate-utils.d.ts +0 -2
- package/dist/server/rpc/delegate-utils.js +0 -5
- package/dist/server/rpc/handler-registry.d.ts +0 -3
- package/dist/server/rpc/handler-registry.js +0 -113
- package/dist/server/rpc/handler-utils.d.ts +0 -23
- package/dist/server/rpc/handler-utils.js +0 -170
- package/dist/server/rpc/handlers/cancel-delegated.d.ts +0 -4
- package/dist/server/rpc/handlers/cancel-delegated.js +0 -71
- package/dist/server/rpc/handlers/get-model-info.d.ts +0 -3
- package/dist/server/rpc/handlers/get-model-info.js +0 -164
- package/dist/server/rpc/handlers/heartbeat-delegated.d.ts +0 -4
- package/dist/server/rpc/handlers/heartbeat-delegated.js +0 -32
- package/dist/server/rpc/handlers/heartbeat.d.ts +0 -3
- package/dist/server/rpc/handlers/heartbeat.js +0 -3
- package/dist/server/rpc/handlers/load-model/download-stats.d.ts +0 -6
- package/dist/server/rpc/handlers/load-model/download-stats.js +0 -87
- package/dist/server/rpc/handlers/load-model/handler.js +0 -187
- package/dist/server/rpc/handlers/load-model/registry.d.ts +0 -11
- package/dist/server/rpc/handlers/load-model/registry.js +0 -548
- package/dist/server/rpc/handlers/load-model/types.d.ts +0 -29
- package/dist/server/rpc/handlers/load-model/types.js +0 -1
- package/dist/server/rpc/handlers/ocr-stream.d.ts +0 -3
- package/dist/server/rpc/handlers/ocr-stream.js +0 -4
- package/dist/server/rpc/handlers/plugin-dispatch.d.ts +0 -15
- package/dist/server/rpc/handlers/plugin-dispatch.js +0 -59
- package/dist/server/rpc/handlers/plugin-invoke.d.ts +0 -4
- package/dist/server/rpc/handlers/plugin-invoke.js +0 -92
- package/dist/server/rpc/handlers/registry.d.ts +0 -5
- package/dist/server/rpc/handlers/registry.js +0 -157
- package/dist/server/rpc/handlers/unload-model-delegated.d.ts +0 -3
- package/dist/server/rpc/handlers/unload-model-delegated.js +0 -32
- package/dist/server/rpc/profiling/context.d.ts +0 -18
- package/dist/server/rpc/profiling/context.js +0 -38
- package/dist/server/rpc/profiling/delegation-profiler.d.ts +0 -32
- package/dist/server/rpc/profiling/delegation-profiler.js +0 -154
- package/dist/server/rpc/profiling/index.d.ts +0 -5
- package/dist/server/rpc/profiling/index.js +0 -4
- package/dist/server/rpc/profiling/operation-metrics.d.ts +0 -25
- package/dist/server/rpc/profiling/operation-metrics.js +0 -199
- package/dist/server/rpc/profiling/operation-wrappers.d.ts +0 -18
- package/dist/server/rpc/profiling/operation-wrappers.js +0 -124
- package/dist/server/rpc/profiling/profiler.d.ts +0 -13
- package/dist/server/rpc/profiling/profiler.js +0 -97
- package/dist/server/utils/archive.d.ts +0 -4
- package/dist/server/utils/archive.js +0 -179
- package/dist/server/utils/checksum.d.ts +0 -4
- package/dist/server/utils/checksum.js +0 -31
- package/dist/server/utils/config-transform.d.ts +0 -3
- package/dist/server/utils/config-transform.js +0 -23
- package/dist/server/utils/formatting.d.ts +0 -19
- package/dist/server/utils/formatting.js +0 -61
- package/dist/server/utils/gguf-tensor-extractor.d.ts +0 -15
- package/dist/server/utils/gguf-tensor-extractor.js +0 -314
- package/dist/server/utils/path-security.d.ts +0 -12
- package/dist/server/utils/path-security.js +0 -25
- package/dist/server/utils/shard-utils.d.ts +0 -48
- package/dist/server/utils/shard-utils.js +0 -125
- package/dist/server/utils/tool-integration.d.ts +0 -13
- package/dist/server/utils/tool-integration.js +0 -43
- package/dist/server/worker-core.d.ts +0 -6
- package/dist/server/worker-core.js +0 -88
- package/dist/utils/errors-base.d.ts +0 -3
- package/dist/utils/errors-base.js +0 -13
- package/dist/utils/errors-client.d.ts +0 -137
- package/dist/utils/errors-client.js +0 -240
- package/dist/utils/errors-server.d.ts +0 -236
- package/dist/utils/errors-server.js +0 -412
- package/dist/utils/global-singleton.d.ts +0 -2
- package/dist/utils/global-singleton.js +0 -10
- package/dist/utils/mcp-adapter.d.ts +0 -12
- package/dist/utils/mcp-adapter.js +0 -103
- package/dist/utils/object.d.ts +0 -2
- package/dist/utils/object.js +0 -3
- package/dist/utils/path-sanitize.d.ts +0 -17
- package/dist/utils/path-sanitize.js +0 -54
- package/dist/utils/tool-helpers.d.ts +0 -25
- package/dist/utils/tool-helpers.js +0 -112
- package/expo/plugins/patches/android-link.mjs +0 -63
- package/expo/plugins/patches/ios-link.mjs +0 -63
- /package/dist/examples/{seed-p2p.js → seed-hyperdrive.js} +0 -0
- /package/dist/examples/{transcription/whispercpp-filesystem.d.ts → whispercpp-filesystem.d.ts} +0 -0
- /package/dist/examples/{transcription/whispercpp-microphone-record.d.ts → whispercpp-microphone-record.d.ts} +0 -0
- /package/dist/models/{registry → hyperdrive}/index.d.ts +0 -0
- /package/dist/server/bare/{ops → addons}/cancel.d.ts +0 -0
- /package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.d.ts +0 -0
- /package/dist/server/bare/{ops → addons}/unload-model.d.ts +0 -0
package/dist/client/api/embed.js
CHANGED
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { send } from "../rpc/rpc-client.js";
|
|
2
2
|
import {} from "../../schemas/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Generates embeddings for a given text using a specified model.
|
|
5
|
+
*
|
|
6
|
+
* @param params - The parameters for the embedding
|
|
7
|
+
* @param params.modelId - The identifier of the embedding model to use
|
|
8
|
+
* @param params.text - The input text to embed
|
|
9
|
+
* @throws {Error} When the response type is invalid or when the embedding fails
|
|
10
|
+
*/
|
|
11
|
+
export async function embed(params) {
|
|
5
12
|
const request = {
|
|
6
13
|
type: "embed",
|
|
7
14
|
...params,
|
|
8
15
|
};
|
|
9
|
-
const response = await send(request
|
|
16
|
+
const response = await send(request);
|
|
10
17
|
if (response.type !== "embed") {
|
|
11
|
-
throw new
|
|
18
|
+
throw new Error("Invalid response type");
|
|
19
|
+
}
|
|
20
|
+
if (!response.success) {
|
|
21
|
+
throw new Error(response.error ?? "Failed to embed");
|
|
12
22
|
}
|
|
13
23
|
return response.embedding;
|
|
14
24
|
}
|
|
@@ -4,17 +4,13 @@ export { completion } from "./completion-stream";
|
|
|
4
4
|
export { deleteCache } from "./delete-cache";
|
|
5
5
|
export { unloadModel } from "./unload-model";
|
|
6
6
|
export { loggingStream } from "./logging-stream";
|
|
7
|
-
export {
|
|
7
|
+
export { ping } from "./ping";
|
|
8
8
|
export { transcribe, transcribeStream } from "./transcribe";
|
|
9
9
|
export { embed } from "./embed";
|
|
10
10
|
export { translate } from "./translate";
|
|
11
11
|
export { cancel } from "./cancel";
|
|
12
12
|
export { startQVACProvider } from "./provide";
|
|
13
13
|
export { stopQVACProvider } from "./stop-provider";
|
|
14
|
-
export {
|
|
14
|
+
export { ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings } from "./rag";
|
|
15
15
|
export { textToSpeech } from "./text-to-speech";
|
|
16
|
-
export { getModelInfo } from "./get-model-info";
|
|
17
|
-
export { ocr } from "./ocr";
|
|
18
|
-
export { invokePlugin, invokePluginStream } from "./invoke-plugin";
|
|
19
|
-
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, } from "./registry";
|
|
20
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/client/api/index.js
CHANGED
|
@@ -4,16 +4,12 @@ export { completion } from "./completion-stream.js";
|
|
|
4
4
|
export { deleteCache } from "./delete-cache.js";
|
|
5
5
|
export { unloadModel } from "./unload-model.js";
|
|
6
6
|
export { loggingStream } from "./logging-stream.js";
|
|
7
|
-
export {
|
|
7
|
+
export { ping } from "./ping.js";
|
|
8
8
|
export { transcribe, transcribeStream } from "./transcribe.js";
|
|
9
9
|
export { embed } from "./embed.js";
|
|
10
10
|
export { translate } from "./translate.js";
|
|
11
11
|
export { cancel } from "./cancel.js";
|
|
12
12
|
export { startQVACProvider } from "./provide.js";
|
|
13
13
|
export { stopQVACProvider } from "./stop-provider.js";
|
|
14
|
-
export {
|
|
14
|
+
export { ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings } from "./rag.js";
|
|
15
15
|
export { textToSpeech } from "./text-to-speech.js";
|
|
16
|
-
export { getModelInfo } from "./get-model-info.js";
|
|
17
|
-
export { ocr } from "./ocr.js";
|
|
18
|
-
export { invokePlugin, invokePluginStream } from "./invoke-plugin.js";
|
|
19
|
-
export { modelRegistryList, modelRegistrySearch, modelRegistryGetModel, } from "./registry.js";
|
|
@@ -1,26 +1,29 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type Logger } from "../../logging/index";
|
|
2
|
+
import { type LoadModelOptions as BaseLoadModelOptions } from "../../schemas/index";
|
|
3
|
+
export type LoadModelOptions = BaseLoadModelOptions & {
|
|
4
|
+
logger?: Logger;
|
|
5
|
+
};
|
|
2
6
|
/**
|
|
3
7
|
* Loads a machine learning model from a local path, remote URL, or Hyperdrive key.
|
|
4
8
|
*
|
|
5
|
-
* This function supports
|
|
6
|
-
*
|
|
9
|
+
* This function supports three model types: LLM (Large Language Model), Whisper (speech recognition),
|
|
10
|
+
* and embeddings. It can handle both local file paths and Hyperdrive URLs (pear://).
|
|
7
11
|
*
|
|
8
12
|
* When `onProgress` is provided, the function uses streaming to provide real-time download progress.
|
|
9
13
|
* Otherwise, it uses a simple request-response pattern for faster execution.
|
|
10
14
|
*
|
|
11
15
|
* @param options - An object that defines all configuration parameters required for loading the model, including:
|
|
12
16
|
* - modelSrc: The location from which the model weights are fetched (local path, remote URL, or Hyperdrive URL)
|
|
13
|
-
* - modelType: The type of model ("llm", "whisper", "embeddings",
|
|
14
|
-
* - modelConfig: Model-specific configuration options
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
* @param rpcOptions - Optional RPC options including per-call profiling configuration
|
|
17
|
+
* - modelType: The type of model ("llm", "whisper", "embeddings", or "nmt")
|
|
18
|
+
* - modelConfig: Model-specific configuration options
|
|
19
|
+
* - projectionModelSrc: (LLM only) Projection model source for multimodal models
|
|
20
|
+
* - vadModelSrc: (Whisper only) VAD model source for voice activity detection
|
|
18
21
|
*
|
|
19
22
|
* @returns Promise that resolves to the model ID (either the provided modelSrc or a generated ID)
|
|
20
23
|
*
|
|
21
|
-
* @throws {
|
|
22
|
-
* @throws {
|
|
23
|
-
* @throws {
|
|
24
|
+
* @throws {Error} When model loading fails, with details in the error message
|
|
25
|
+
* @throws {Error} When streaming ends unexpectedly (only when using onProgress)
|
|
26
|
+
* @throws {Error} When receiving an invalid response type from the server
|
|
24
27
|
*
|
|
25
28
|
* @example
|
|
26
29
|
* ```typescript
|
|
@@ -57,10 +60,8 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
|
|
|
57
60
|
* const multimodalId = await loadModel({
|
|
58
61
|
* modelSrc: "https://huggingface.co/.../main-model.gguf",
|
|
59
62
|
* modelType: "llm",
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* projectionModelSrc: "https://huggingface.co/.../projection-model.gguf"
|
|
63
|
-
* },
|
|
63
|
+
* projectionModelSrc: "https://huggingface.co/.../projection-model.gguf",
|
|
64
|
+
* modelConfig: { ctx_size: 512 },
|
|
64
65
|
* onProgress: (progress) => {
|
|
65
66
|
* console.log(`Loading: ${progress.percentage}%`);
|
|
66
67
|
* }
|
|
@@ -70,12 +71,12 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
|
|
|
70
71
|
* const whisperId = await loadModel({
|
|
71
72
|
* modelSrc: "https://huggingface.co/.../whisper-model.gguf",
|
|
72
73
|
* modelType: "whisper",
|
|
74
|
+
* vadModelSrc: "https://huggingface.co/.../vad-model.bin",
|
|
73
75
|
* modelConfig: {
|
|
74
76
|
* mode: "caption",
|
|
75
77
|
* output_format: "plaintext",
|
|
76
78
|
* min_seconds: 2,
|
|
77
|
-
* max_seconds: 6
|
|
78
|
-
* vadModelSrc: "https://huggingface.co/.../vad-model.bin"
|
|
79
|
+
* max_seconds: 6
|
|
79
80
|
* }
|
|
80
81
|
* });
|
|
81
82
|
*
|
|
@@ -88,39 +89,10 @@ import { type LoadModelOptions, type ReloadConfigOptions, type RPCOptions } from
|
|
|
88
89
|
* modelType: "llm",
|
|
89
90
|
* logger // Pass logger in options
|
|
90
91
|
* });
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export declare function loadModel(options: LoadModelOptions, rpcOptions?: RPCOptions): Promise<string>;
|
|
94
|
-
/**
|
|
95
|
-
* Hot-reloads configuration on an already loaded model.
|
|
96
92
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* - modelType: The type of model (must match the loaded model)
|
|
100
|
-
* - modelConfig: New configuration to apply
|
|
101
|
-
* @param rpcOptions - Optional RPC options including per-call profiling configuration
|
|
102
|
-
*
|
|
103
|
-
* @returns Promise that resolves to the model ID
|
|
104
|
-
*
|
|
105
|
-
* @throws {QvacErrorBase} When model reload fails, with details in the error message
|
|
106
|
-
* @throws {QvacErrorBase} When receiving an invalid response type from the server
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```typescript
|
|
110
|
-
* // Load new model
|
|
111
|
-
* const modelId = await loadModel({
|
|
112
|
-
* modelSrc: "pear://<hyperdrive-key>/whisper-tiny.gguf",
|
|
113
|
-
* modelType: "whisper",
|
|
114
|
-
* modelConfig: { language: "en" },
|
|
115
|
-
* });
|
|
116
|
-
*
|
|
117
|
-
* // Later, update the config without reloading the model
|
|
118
|
-
* await loadModel({
|
|
119
|
-
* modelId,
|
|
120
|
-
* modelType: "whisper",
|
|
121
|
-
* modelConfig: { language: "es" },
|
|
122
|
-
* });
|
|
93
|
+
* // Now any logs from the model operations will appear in your logger automatically
|
|
94
|
+
* // No need to manually manage logging streams!
|
|
123
95
|
* ```
|
|
124
96
|
*/
|
|
125
|
-
export declare function loadModel(options:
|
|
97
|
+
export declare function loadModel(options: LoadModelOptions): Promise<string>;
|
|
126
98
|
//# sourceMappingURL=load-model.d.ts.map
|
|
@@ -1,62 +1,156 @@
|
|
|
1
1
|
import { send, stream } from "../rpc/rpc-client.js";
|
|
2
|
+
import {} from "../../logging/index.js";
|
|
2
3
|
import { startLoggingStreamForModel } from "../logging-stream-registry.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
import { loadModelRequestSchema, } from "../../schemas/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Loads a machine learning model from a local path, remote URL, or Hyperdrive key.
|
|
7
|
+
*
|
|
8
|
+
* This function supports three model types: LLM (Large Language Model), Whisper (speech recognition),
|
|
9
|
+
* and embeddings. It can handle both local file paths and Hyperdrive URLs (pear://).
|
|
10
|
+
*
|
|
11
|
+
* When `onProgress` is provided, the function uses streaming to provide real-time download progress.
|
|
12
|
+
* Otherwise, it uses a simple request-response pattern for faster execution.
|
|
13
|
+
*
|
|
14
|
+
* @param options - An object that defines all configuration parameters required for loading the model, including:
|
|
15
|
+
* - modelSrc: The location from which the model weights are fetched (local path, remote URL, or Hyperdrive URL)
|
|
16
|
+
* - modelType: The type of model ("llm", "whisper", "embeddings", or "nmt")
|
|
17
|
+
* - modelConfig: Model-specific configuration options
|
|
18
|
+
* - projectionModelSrc: (LLM only) Projection model source for multimodal models
|
|
19
|
+
* - vadModelSrc: (Whisper only) VAD model source for voice activity detection
|
|
20
|
+
*
|
|
21
|
+
* @returns Promise that resolves to the model ID (either the provided modelSrc or a generated ID)
|
|
22
|
+
*
|
|
23
|
+
* @throws {Error} When model loading fails, with details in the error message
|
|
24
|
+
* @throws {Error} When streaming ends unexpectedly (only when using onProgress)
|
|
25
|
+
* @throws {Error} When receiving an invalid response type from the server
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Local file path - absolute path
|
|
30
|
+
* const localModelId = await loadModel({
|
|
31
|
+
* modelSrc: "/home/user/models/llama-7b.gguf",
|
|
32
|
+
* modelType: "llm",
|
|
33
|
+
* modelConfig: { contextSize: 2048 }
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Local file path - relative path
|
|
37
|
+
* const relativeModelId = await loadModel({
|
|
38
|
+
* modelSrc: "./models/whisper-base.gguf",
|
|
39
|
+
* modelType: "whisper"
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* // Hyperdrive URL with key and path
|
|
43
|
+
* const hyperdriveId = await loadModel({
|
|
44
|
+
* modelSrc: "pear://<hyperdrive-key>/llama-7b.gguf",
|
|
45
|
+
* modelType: "llm",
|
|
46
|
+
* modelConfig: { contextSize: 2048 }
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* // Remote HTTP/HTTPS URL with progress tracking
|
|
50
|
+
* const remoteId = await loadModel({
|
|
51
|
+
* modelSrc: "https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF/resolve/main/llama-2-7b-chat.Q4_K_M.gguf",
|
|
52
|
+
* modelType: "llm",
|
|
53
|
+
* onProgress: (progress) => {
|
|
54
|
+
* console.log(`Downloaded: ${progress.percentage}%`);
|
|
55
|
+
* }
|
|
56
|
+
* });
|
|
57
|
+
*
|
|
58
|
+
* // Multimodal model with projection
|
|
59
|
+
* const multimodalId = await loadModel({
|
|
60
|
+
* modelSrc: "https://huggingface.co/.../main-model.gguf",
|
|
61
|
+
* modelType: "llm",
|
|
62
|
+
* projectionModelSrc: "https://huggingface.co/.../projection-model.gguf",
|
|
63
|
+
* modelConfig: { ctx_size: 512 },
|
|
64
|
+
* onProgress: (progress) => {
|
|
65
|
+
* console.log(`Loading: ${progress.percentage}%`);
|
|
66
|
+
* }
|
|
67
|
+
* });
|
|
68
|
+
*
|
|
69
|
+
* // Whisper with VAD model
|
|
70
|
+
* const whisperId = await loadModel({
|
|
71
|
+
* modelSrc: "https://huggingface.co/.../whisper-model.gguf",
|
|
72
|
+
* modelType: "whisper",
|
|
73
|
+
* vadModelSrc: "https://huggingface.co/.../vad-model.bin",
|
|
74
|
+
* modelConfig: {
|
|
75
|
+
* mode: "caption",
|
|
76
|
+
* output_format: "plaintext",
|
|
77
|
+
* min_seconds: 2,
|
|
78
|
+
* max_seconds: 6
|
|
79
|
+
* }
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* // Load with automatic logging - logs from the model will be forwarded to your logger
|
|
83
|
+
* import { getLogger } from "../../logging/index.js";
|
|
84
|
+
* const logger = getLogger("my-app");
|
|
85
|
+
*
|
|
86
|
+
* const modelId = await loadModel({
|
|
87
|
+
* modelSrc: "/path/to/model.gguf",
|
|
88
|
+
* modelType: "llm",
|
|
89
|
+
* logger // Pass logger in options
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* // Now any logs from the model operations will appear in your logger automatically
|
|
93
|
+
* // No need to manually manage logging streams!
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export async function loadModel(options) {
|
|
97
|
+
const { logger, modelSrc } = options;
|
|
98
|
+
const request = loadModelRequestSchema.parse({
|
|
99
|
+
type: "loadModel",
|
|
100
|
+
modelSrc: modelSrc,
|
|
101
|
+
projectionModelSrc: options.modelType === "llm" ? options.projectionModelSrc : undefined,
|
|
102
|
+
vadModelSrc: options.modelType === "whisper" ? options.vadModelSrc : undefined,
|
|
103
|
+
configSrc: options.modelType === "tts" ? options.configSrc : undefined,
|
|
104
|
+
eSpeakDataPath: options.modelType === "tts" ? options.eSpeakDataPath : undefined,
|
|
105
|
+
withProgress: !!options.onProgress,
|
|
106
|
+
seed: options.seed,
|
|
107
|
+
modelType: options.modelType,
|
|
108
|
+
modelConfig: options.modelConfig ?? {},
|
|
109
|
+
delegate: options.delegate,
|
|
110
|
+
});
|
|
111
|
+
if (options.onProgress) {
|
|
20
112
|
// Use streaming for progress updates
|
|
21
|
-
for await (const response of stream(request
|
|
113
|
+
for await (const response of stream(request)) {
|
|
22
114
|
if (response.type === "modelProgress") {
|
|
23
|
-
onProgress(response);
|
|
115
|
+
options.onProgress(response);
|
|
24
116
|
}
|
|
25
117
|
else if (response.type === "loadModel") {
|
|
26
118
|
if (!response.success) {
|
|
27
|
-
throw new
|
|
119
|
+
throw new Error(response.error ?? "Failed to load model");
|
|
28
120
|
}
|
|
29
|
-
const modelId = response.modelId;
|
|
121
|
+
const modelId = response.modelId ?? modelSrc;
|
|
30
122
|
// Start logging stream in the background if logger is provided, catch to avoid failing the entire loadModel operation
|
|
31
|
-
if (
|
|
123
|
+
if (logger) {
|
|
32
124
|
try {
|
|
33
|
-
startLoggingStreamForModel(modelId,
|
|
125
|
+
startLoggingStreamForModel(modelId, logger);
|
|
34
126
|
}
|
|
35
127
|
catch (error) {
|
|
36
|
-
|
|
128
|
+
console.warn(`Failed to start logging stream for model ${modelId}:`, error);
|
|
37
129
|
}
|
|
38
130
|
}
|
|
39
131
|
return modelId;
|
|
40
132
|
}
|
|
41
133
|
}
|
|
42
|
-
throw new
|
|
43
|
-
}
|
|
44
|
-
// Use regular send for simple loading
|
|
45
|
-
const response = await send(request, rpcOptions);
|
|
46
|
-
if (response.type !== "loadModel") {
|
|
47
|
-
throw new InvalidResponseError("loadModel");
|
|
48
|
-
}
|
|
49
|
-
if (!response.success) {
|
|
50
|
-
throw new ModelLoadFailedError(response.error);
|
|
134
|
+
throw new Error("Stream ended without final response");
|
|
51
135
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
136
|
+
else {
|
|
137
|
+
// Use regular send for simple loading
|
|
138
|
+
const response = await send(request);
|
|
139
|
+
if (response.type !== "loadModel") {
|
|
140
|
+
throw new Error("Invalid response type");
|
|
56
141
|
}
|
|
57
|
-
|
|
58
|
-
|
|
142
|
+
if (!response.success) {
|
|
143
|
+
throw new Error(response.error ?? "Failed to load model");
|
|
144
|
+
}
|
|
145
|
+
const modelId = response.modelId ?? modelSrc;
|
|
146
|
+
if (logger) {
|
|
147
|
+
try {
|
|
148
|
+
startLoggingStreamForModel(modelId, logger);
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
console.warn(`Failed to start logging stream for model ${modelId}:`, error);
|
|
152
|
+
}
|
|
59
153
|
}
|
|
154
|
+
return modelId;
|
|
60
155
|
}
|
|
61
|
-
return modelId;
|
|
62
156
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import type { LoggingStreamResponse, LoggingParams } from "../../schemas/logging-stream";
|
|
2
2
|
/**
|
|
3
|
-
* Opens a logging stream to receive real-time logs.
|
|
3
|
+
* Opens a logging stream for a specific model to receive real-time logs.
|
|
4
4
|
*
|
|
5
5
|
* @param params - The arguments for the logging stream
|
|
6
|
-
* @param params.
|
|
6
|
+
* @param params.modelId - The unique identifier of the model to stream logs for
|
|
7
7
|
* @returns AsyncGenerator yielding logging stream responses
|
|
8
|
-
* @throws {
|
|
8
|
+
* @throws {Error} When the response type is invalid or when the stream fails
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```typescript
|
|
12
12
|
* // Open a logging stream for a model
|
|
13
|
-
* const logStream = loggingStream({
|
|
14
|
-
*
|
|
15
|
-
* // Or stream SDK server logs
|
|
16
|
-
* const sdkLogs = loggingStream({ id: SDK_LOG_ID });
|
|
13
|
+
* const logStream = loggingStream({ modelId: 'my-model-id' });
|
|
17
14
|
*
|
|
18
15
|
* for await (const logMessage of logStream) {
|
|
19
16
|
* console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { stream } from "../rpc/rpc-client.js";
|
|
2
|
-
import { InvalidResponseError } from "../../utils/errors-client.js";
|
|
3
2
|
/**
|
|
4
|
-
* Opens a logging stream to receive real-time logs.
|
|
3
|
+
* Opens a logging stream for a specific model to receive real-time logs.
|
|
5
4
|
*
|
|
6
5
|
* @param params - The arguments for the logging stream
|
|
7
|
-
* @param params.
|
|
6
|
+
* @param params.modelId - The unique identifier of the model to stream logs for
|
|
8
7
|
* @returns AsyncGenerator yielding logging stream responses
|
|
9
|
-
* @throws {
|
|
8
|
+
* @throws {Error} When the response type is invalid or when the stream fails
|
|
10
9
|
*
|
|
11
10
|
* @example
|
|
12
11
|
* ```typescript
|
|
13
12
|
* // Open a logging stream for a model
|
|
14
|
-
* const logStream = loggingStream({
|
|
15
|
-
*
|
|
16
|
-
* // Or stream SDK server logs
|
|
17
|
-
* const sdkLogs = loggingStream({ id: SDK_LOG_ID });
|
|
13
|
+
* const logStream = loggingStream({ modelId: 'my-model-id' });
|
|
18
14
|
*
|
|
19
15
|
* for await (const logMessage of logStream) {
|
|
20
16
|
* console.log(`[${logMessage.level}] ${logMessage.namespace}: ${logMessage.message}`);
|
|
@@ -29,7 +25,7 @@ export async function* loggingStream(params) {
|
|
|
29
25
|
const responseStream = stream(request);
|
|
30
26
|
for await (const response of responseStream) {
|
|
31
27
|
if (response.type !== "loggingStream") {
|
|
32
|
-
throw new
|
|
28
|
+
throw new Error("Invalid response type");
|
|
33
29
|
}
|
|
34
30
|
yield response;
|
|
35
31
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sends a ping request to the server and returns the pong response.
|
|
3
|
+
*
|
|
4
|
+
* @returns A promise that resolves to a pong response containing a number.
|
|
5
|
+
* @throws {Error} When the response type is not "pong".
|
|
6
|
+
*/
|
|
7
|
+
export declare function ping(): Promise<{
|
|
8
|
+
type: "pong";
|
|
9
|
+
number: number;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=ping.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {} from "../../schemas/index.js";
|
|
2
|
+
import { send } from "../rpc/rpc-client.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sends a ping request to the server and returns the pong response.
|
|
5
|
+
*
|
|
6
|
+
* @returns A promise that resolves to a pong response containing a number.
|
|
7
|
+
* @throws {Error} When the response type is not "pong".
|
|
8
|
+
*/
|
|
9
|
+
export async function ping() {
|
|
10
|
+
const request = {
|
|
11
|
+
type: "ping",
|
|
12
|
+
};
|
|
13
|
+
const response = await send(request);
|
|
14
|
+
if (response.type !== "pong") {
|
|
15
|
+
throw new Error("Invalid response type");
|
|
16
|
+
}
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
@@ -7,7 +7,7 @@ import { type ProvideParams } from "../../schemas/index";
|
|
|
7
7
|
* @param options.topic - Topic hex string for peer discovery
|
|
8
8
|
* @param options.firewall - Optional firewall configuration to allow/deny specific public keys
|
|
9
9
|
* @returns A promise that resolves to the provide response containing success status and public key
|
|
10
|
-
* @throws {
|
|
10
|
+
* @throws {Error} When the response type is not "provide" or the request fails
|
|
11
11
|
*/
|
|
12
12
|
export declare function startQVACProvider(params: ProvideParams): Promise<{
|
|
13
13
|
type: "provide";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {} from "../../schemas/index.js";
|
|
2
2
|
import { send } from "../rpc/rpc-client.js";
|
|
3
|
-
import { InvalidResponseError, ProviderStartFailedError, } from "../../utils/errors-client.js";
|
|
4
3
|
/**
|
|
5
4
|
* Starts a provider service that offers QVAC capabilities to remote peers.
|
|
6
5
|
* The provider's keypair can be controlled via the seed option or QVAC_HYPERSWARM_SEED environment variable.
|
|
@@ -9,7 +8,7 @@ import { InvalidResponseError, ProviderStartFailedError, } from "../../utils/err
|
|
|
9
8
|
* @param options.topic - Topic hex string for peer discovery
|
|
10
9
|
* @param options.firewall - Optional firewall configuration to allow/deny specific public keys
|
|
11
10
|
* @returns A promise that resolves to the provide response containing success status and public key
|
|
12
|
-
* @throws {
|
|
11
|
+
* @throws {Error} When the response type is not "provide" or the request fails
|
|
13
12
|
*/
|
|
14
13
|
export async function startQVACProvider(params) {
|
|
15
14
|
const request = {
|
|
@@ -19,10 +18,10 @@ export async function startQVACProvider(params) {
|
|
|
19
18
|
};
|
|
20
19
|
const response = await send(request);
|
|
21
20
|
if (response.type !== "provide") {
|
|
22
|
-
throw new
|
|
21
|
+
throw new Error("Invalid response type");
|
|
23
22
|
}
|
|
24
23
|
if (response.error) {
|
|
25
|
-
throw new
|
|
24
|
+
throw new Error(response.error);
|
|
26
25
|
}
|
|
27
26
|
return response;
|
|
28
27
|
}
|