@trymirai/uzu 0.3.0 → 0.4.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 +1 -1
- package/README.md +253 -245
- package/index.d.mts +1 -43
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -43
- package/index.d.ts.map +1 -1
- package/index.js +2 -88
- package/index.js.map +1 -1
- package/index.mjs +1 -43
- package/index.mjs.map +1 -1
- package/internal/tslib.js +6 -33
- package/napi/index.d.ts +975 -0
- package/napi/index.js +626 -0
- package/napi/index.mjs +3 -0
- package/napi/{uzu.node → uzu.darwin-arm64.node} +0 -0
- package/package.json +26 -63
- package/src/index.ts +1 -43
- package/src/napi/index.d.ts +975 -0
- package/src/napi/index.js +626 -0
- package/src/napi/index.mjs +3 -0
- package/src/napi/{uzu.node → uzu.darwin-arm64.node} +0 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/bridging/asyncBatchSize.d.mts +0 -10
- package/bridging/asyncBatchSize.d.mts.map +0 -1
- package/bridging/asyncBatchSize.d.ts +0 -10
- package/bridging/asyncBatchSize.d.ts.map +0 -1
- package/bridging/asyncBatchSize.js +0 -21
- package/bridging/asyncBatchSize.js.map +0 -1
- package/bridging/asyncBatchSize.mjs +0 -17
- package/bridging/asyncBatchSize.mjs.map +0 -1
- package/bridging/chatSession.d.mts +0 -11
- package/bridging/chatSession.d.mts.map +0 -1
- package/bridging/chatSession.d.ts +0 -11
- package/bridging/chatSession.d.ts.map +0 -1
- package/bridging/chatSession.js +0 -22
- package/bridging/chatSession.js.map +0 -1
- package/bridging/chatSession.mjs +0 -18
- package/bridging/chatSession.mjs.map +0 -1
- package/bridging/classificationFeature.d.mts +0 -9
- package/bridging/classificationFeature.d.mts.map +0 -1
- package/bridging/classificationFeature.d.ts +0 -9
- package/bridging/classificationFeature.d.ts.map +0 -1
- package/bridging/classificationFeature.js +0 -18
- package/bridging/classificationFeature.js.map +0 -1
- package/bridging/classificationFeature.mjs +0 -14
- package/bridging/classificationFeature.mjs.map +0 -1
- package/bridging/classificationLabel.d.mts +0 -12
- package/bridging/classificationLabel.d.mts.map +0 -1
- package/bridging/classificationLabel.d.ts +0 -12
- package/bridging/classificationLabel.d.ts.map +0 -1
- package/bridging/classificationLabel.js +0 -26
- package/bridging/classificationLabel.js.map +0 -1
- package/bridging/classificationLabel.mjs +0 -22
- package/bridging/classificationLabel.mjs.map +0 -1
- package/bridging/classificationOutput.d.mts +0 -10
- package/bridging/classificationOutput.d.mts.map +0 -1
- package/bridging/classificationOutput.d.ts +0 -10
- package/bridging/classificationOutput.d.ts.map +0 -1
- package/bridging/classificationOutput.js +0 -16
- package/bridging/classificationOutput.js.map +0 -1
- package/bridging/classificationOutput.mjs +0 -12
- package/bridging/classificationOutput.mjs.map +0 -1
- package/bridging/classificationSession.d.mts +0 -9
- package/bridging/classificationSession.d.mts.map +0 -1
- package/bridging/classificationSession.d.ts +0 -9
- package/bridging/classificationSession.d.ts.map +0 -1
- package/bridging/classificationSession.js +0 -16
- package/bridging/classificationSession.js.map +0 -1
- package/bridging/classificationSession.mjs +0 -12
- package/bridging/classificationSession.mjs.map +0 -1
- package/bridging/classificationStats.d.mts +0 -14
- package/bridging/classificationStats.d.mts.map +0 -1
- package/bridging/classificationStats.d.ts +0 -14
- package/bridging/classificationStats.d.ts.map +0 -1
- package/bridging/classificationStats.js +0 -20
- package/bridging/classificationStats.js.map +0 -1
- package/bridging/classificationStats.mjs +0 -16
- package/bridging/classificationStats.mjs.map +0 -1
- package/bridging/config.d.mts +0 -26
- package/bridging/config.d.mts.map +0 -1
- package/bridging/config.d.ts +0 -26
- package/bridging/config.d.ts.map +0 -1
- package/bridging/config.js +0 -53
- package/bridging/config.js.map +0 -1
- package/bridging/config.mjs +0 -49
- package/bridging/config.mjs.map +0 -1
- package/bridging/contextLength.d.mts +0 -11
- package/bridging/contextLength.d.mts.map +0 -1
- package/bridging/contextLength.d.ts +0 -11
- package/bridging/contextLength.d.ts.map +0 -1
- package/bridging/contextLength.js +0 -25
- package/bridging/contextLength.js.map +0 -1
- package/bridging/contextLength.mjs +0 -21
- package/bridging/contextLength.mjs.map +0 -1
- package/bridging/contextMode.d.mts +0 -12
- package/bridging/contextMode.d.mts.map +0 -1
- package/bridging/contextMode.d.ts +0 -12
- package/bridging/contextMode.d.ts.map +0 -1
- package/bridging/contextMode.js +0 -26
- package/bridging/contextMode.js.map +0 -1
- package/bridging/contextMode.mjs +0 -22
- package/bridging/contextMode.mjs.map +0 -1
- package/bridging/downloadHandle.d.mts +0 -14
- package/bridging/downloadHandle.d.mts.map +0 -1
- package/bridging/downloadHandle.d.ts +0 -14
- package/bridging/downloadHandle.d.ts.map +0 -1
- package/bridging/downloadHandle.js +0 -36
- package/bridging/downloadHandle.js.map +0 -1
- package/bridging/downloadHandle.mjs +0 -32
- package/bridging/downloadHandle.mjs.map +0 -1
- package/bridging/downloadProgressUpdate.d.mts +0 -9
- package/bridging/downloadProgressUpdate.d.mts.map +0 -1
- package/bridging/downloadProgressUpdate.d.ts +0 -9
- package/bridging/downloadProgressUpdate.d.ts.map +0 -1
- package/bridging/downloadProgressUpdate.js +0 -15
- package/bridging/downloadProgressUpdate.js.map +0 -1
- package/bridging/downloadProgressUpdate.mjs +0 -11
- package/bridging/downloadProgressUpdate.mjs.map +0 -1
- package/bridging/downloadState.d.mts +0 -19
- package/bridging/downloadState.d.mts.map +0 -1
- package/bridging/downloadState.d.ts +0 -19
- package/bridging/downloadState.d.ts.map +0 -1
- package/bridging/downloadState.js +0 -45
- package/bridging/downloadState.js.map +0 -1
- package/bridging/downloadState.mjs +0 -41
- package/bridging/downloadState.mjs.map +0 -1
- package/bridging/engine.d.mts +0 -29
- package/bridging/engine.d.mts.map +0 -1
- package/bridging/engine.d.ts +0 -29
- package/bridging/engine.d.ts.map +0 -1
- package/bridging/engine.js +0 -117
- package/bridging/engine.js.map +0 -1
- package/bridging/engine.mjs +0 -113
- package/bridging/engine.mjs.map +0 -1
- package/bridging/finishReason.d.mts +0 -7
- package/bridging/finishReason.d.mts.map +0 -1
- package/bridging/finishReason.d.ts +0 -7
- package/bridging/finishReason.d.ts.map +0 -1
- package/bridging/finishReason.js +0 -11
- package/bridging/finishReason.js.map +0 -1
- package/bridging/finishReason.mjs +0 -8
- package/bridging/finishReason.mjs.map +0 -1
- package/bridging/grammarConfig.d.mts +0 -13
- package/bridging/grammarConfig.d.mts.map +0 -1
- package/bridging/grammarConfig.d.ts +0 -13
- package/bridging/grammarConfig.d.ts.map +0 -1
- package/bridging/grammarConfig.js +0 -36
- package/bridging/grammarConfig.js.map +0 -1
- package/bridging/grammarConfig.mjs +0 -31
- package/bridging/grammarConfig.mjs.map +0 -1
- package/bridging/input.d.mts +0 -11
- package/bridging/input.d.mts.map +0 -1
- package/bridging/input.d.ts +0 -11
- package/bridging/input.d.ts.map +0 -1
- package/bridging/input.js +0 -25
- package/bridging/input.js.map +0 -1
- package/bridging/input.mjs +0 -21
- package/bridging/input.mjs.map +0 -1
- package/bridging/licenseStatus.d.mts +0 -14
- package/bridging/licenseStatus.d.mts.map +0 -1
- package/bridging/licenseStatus.d.ts +0 -14
- package/bridging/licenseStatus.d.ts.map +0 -1
- package/bridging/licenseStatus.js +0 -42
- package/bridging/licenseStatus.js.map +0 -1
- package/bridging/licenseStatus.mjs +0 -38
- package/bridging/licenseStatus.mjs.map +0 -1
- package/bridging/message.d.mts +0 -15
- package/bridging/message.d.mts.map +0 -1
- package/bridging/message.d.ts +0 -15
- package/bridging/message.d.ts.map +0 -1
- package/bridging/message.js +0 -43
- package/bridging/message.js.map +0 -1
- package/bridging/message.mjs +0 -39
- package/bridging/message.mjs.map +0 -1
- package/bridging/model.d.mts +0 -19
- package/bridging/model.d.mts.map +0 -1
- package/bridging/model.d.ts +0 -19
- package/bridging/model.d.ts.map +0 -1
- package/bridging/model.js +0 -39
- package/bridging/model.js.map +0 -1
- package/bridging/model.mjs +0 -35
- package/bridging/model.mjs.map +0 -1
- package/bridging/modelKind.d.mts +0 -8
- package/bridging/modelKind.d.mts.map +0 -1
- package/bridging/modelKind.d.ts +0 -8
- package/bridging/modelKind.d.ts.map +0 -1
- package/bridging/modelKind.js +0 -30
- package/bridging/modelKind.js.map +0 -1
- package/bridging/modelKind.mjs +0 -25
- package/bridging/modelKind.mjs.map +0 -1
- package/bridging/modelType.d.mts +0 -9
- package/bridging/modelType.d.mts.map +0 -1
- package/bridging/modelType.d.ts +0 -9
- package/bridging/modelType.d.ts.map +0 -1
- package/bridging/modelType.js +0 -35
- package/bridging/modelType.js.map +0 -1
- package/bridging/modelType.mjs +0 -30
- package/bridging/modelType.mjs.map +0 -1
- package/bridging/napi.d.mts +0 -4
- package/bridging/napi.d.mts.map +0 -1
- package/bridging/napi.d.ts +0 -4
- package/bridging/napi.d.ts.map +0 -1
- package/bridging/napi.js +0 -3
- package/bridging/napi.js.map +0 -1
- package/bridging/napi.mjs +0 -2
- package/bridging/napi.mjs.map +0 -1
- package/bridging/output.d.mts +0 -13
- package/bridging/output.d.mts.map +0 -1
- package/bridging/output.d.ts +0 -13
- package/bridging/output.d.ts.map +0 -1
- package/bridging/output.js +0 -36
- package/bridging/output.js.map +0 -1
- package/bridging/output.mjs +0 -32
- package/bridging/output.mjs.map +0 -1
- package/bridging/parsedText.d.mts +0 -10
- package/bridging/parsedText.d.mts.map +0 -1
- package/bridging/parsedText.d.ts +0 -10
- package/bridging/parsedText.d.ts.map +0 -1
- package/bridging/parsedText.js +0 -24
- package/bridging/parsedText.js.map +0 -1
- package/bridging/parsedText.mjs +0 -20
- package/bridging/parsedText.mjs.map +0 -1
- package/bridging/prefillStepSize.d.mts +0 -11
- package/bridging/prefillStepSize.d.mts.map +0 -1
- package/bridging/prefillStepSize.d.ts +0 -11
- package/bridging/prefillStepSize.d.ts.map +0 -1
- package/bridging/prefillStepSize.js +0 -28
- package/bridging/prefillStepSize.js.map +0 -1
- package/bridging/prefillStepSize.mjs +0 -24
- package/bridging/prefillStepSize.mjs.map +0 -1
- package/bridging/preset.d.mts +0 -14
- package/bridging/preset.d.mts.map +0 -1
- package/bridging/preset.d.ts +0 -14
- package/bridging/preset.d.ts.map +0 -1
- package/bridging/preset.js +0 -41
- package/bridging/preset.js.map +0 -1
- package/bridging/preset.mjs +0 -37
- package/bridging/preset.mjs.map +0 -1
- package/bridging/role.d.mts +0 -6
- package/bridging/role.d.mts.map +0 -1
- package/bridging/role.d.ts +0 -6
- package/bridging/role.d.ts.map +0 -1
- package/bridging/role.js +0 -10
- package/bridging/role.js.map +0 -1
- package/bridging/role.mjs +0 -7
- package/bridging/role.mjs.map +0 -1
- package/bridging/runConfig.d.mts +0 -18
- package/bridging/runConfig.d.mts.map +0 -1
- package/bridging/runConfig.d.ts +0 -18
- package/bridging/runConfig.d.ts.map +0 -1
- package/bridging/runConfig.js +0 -42
- package/bridging/runConfig.js.map +0 -1
- package/bridging/runConfig.mjs +0 -38
- package/bridging/runConfig.mjs.map +0 -1
- package/bridging/runStats.d.mts +0 -8
- package/bridging/runStats.d.mts.map +0 -1
- package/bridging/runStats.d.ts +0 -8
- package/bridging/runStats.d.ts.map +0 -1
- package/bridging/runStats.js +0 -16
- package/bridging/runStats.js.map +0 -1
- package/bridging/runStats.mjs +0 -12
- package/bridging/runStats.mjs.map +0 -1
- package/bridging/samplingMethod.d.mts +0 -11
- package/bridging/samplingMethod.d.mts.map +0 -1
- package/bridging/samplingMethod.d.ts +0 -11
- package/bridging/samplingMethod.d.ts.map +0 -1
- package/bridging/samplingMethod.js +0 -37
- package/bridging/samplingMethod.js.map +0 -1
- package/bridging/samplingMethod.mjs +0 -33
- package/bridging/samplingMethod.mjs.map +0 -1
- package/bridging/samplingPolicy.d.mts +0 -11
- package/bridging/samplingPolicy.d.mts.map +0 -1
- package/bridging/samplingPolicy.d.ts +0 -11
- package/bridging/samplingPolicy.d.ts.map +0 -1
- package/bridging/samplingPolicy.js +0 -25
- package/bridging/samplingPolicy.js.map +0 -1
- package/bridging/samplingPolicy.mjs +0 -21
- package/bridging/samplingPolicy.mjs.map +0 -1
- package/bridging/samplingProcessingOrder.d.mts +0 -8
- package/bridging/samplingProcessingOrder.d.mts.map +0 -1
- package/bridging/samplingProcessingOrder.d.ts +0 -8
- package/bridging/samplingProcessingOrder.d.ts.map +0 -1
- package/bridging/samplingProcessingOrder.js +0 -30
- package/bridging/samplingProcessingOrder.js.map +0 -1
- package/bridging/samplingProcessingOrder.mjs +0 -25
- package/bridging/samplingProcessingOrder.mjs.map +0 -1
- package/bridging/samplingSeed.d.mts +0 -10
- package/bridging/samplingSeed.d.mts.map +0 -1
- package/bridging/samplingSeed.d.ts +0 -10
- package/bridging/samplingSeed.d.ts.map +0 -1
- package/bridging/samplingSeed.js +0 -21
- package/bridging/samplingSeed.js.map +0 -1
- package/bridging/samplingSeed.mjs +0 -17
- package/bridging/samplingSeed.mjs.map +0 -1
- package/bridging/stats.d.mts +0 -11
- package/bridging/stats.d.mts.map +0 -1
- package/bridging/stats.d.ts +0 -11
- package/bridging/stats.d.ts.map +0 -1
- package/bridging/stats.js +0 -20
- package/bridging/stats.js.map +0 -1
- package/bridging/stats.mjs +0 -16
- package/bridging/stats.mjs.map +0 -1
- package/bridging/stepStats.d.mts +0 -14
- package/bridging/stepStats.d.mts.map +0 -1
- package/bridging/stepStats.d.ts +0 -14
- package/bridging/stepStats.d.ts.map +0 -1
- package/bridging/stepStats.js +0 -27
- package/bridging/stepStats.js.map +0 -1
- package/bridging/stepStats.mjs +0 -23
- package/bridging/stepStats.mjs.map +0 -1
- package/bridging/text.d.mts +0 -9
- package/bridging/text.d.mts.map +0 -1
- package/bridging/text.d.ts +0 -9
- package/bridging/text.d.ts.map +0 -1
- package/bridging/text.js +0 -17
- package/bridging/text.js.map +0 -1
- package/bridging/text.mjs +0 -13
- package/bridging/text.mjs.map +0 -1
- package/bridging/textToSpeechSession.d.mts +0 -8
- package/bridging/textToSpeechSession.d.mts.map +0 -1
- package/bridging/textToSpeechSession.d.ts +0 -8
- package/bridging/textToSpeechSession.d.ts.map +0 -1
- package/bridging/textToSpeechSession.js +0 -14
- package/bridging/textToSpeechSession.js.map +0 -1
- package/bridging/textToSpeechSession.mjs +0 -10
- package/bridging/textToSpeechSession.mjs.map +0 -1
- package/bridging/totalStats.d.mts +0 -9
- package/bridging/totalStats.d.mts.map +0 -1
- package/bridging/totalStats.d.ts +0 -9
- package/bridging/totalStats.d.ts.map +0 -1
- package/bridging/totalStats.js +0 -18
- package/bridging/totalStats.js.map +0 -1
- package/bridging/totalStats.mjs +0 -14
- package/bridging/totalStats.mjs.map +0 -1
- package/error.d.mts +0 -18
- package/error.d.mts.map +0 -1
- package/error.d.ts +0 -18
- package/error.d.ts.map +0 -1
- package/error.js +0 -46
- package/error.js.map +0 -1
- package/error.mjs +0 -41
- package/error.mjs.map +0 -1
- package/interactors/chatModelInteractor.d.mts +0 -34
- package/interactors/chatModelInteractor.d.mts.map +0 -1
- package/interactors/chatModelInteractor.d.ts +0 -34
- package/interactors/chatModelInteractor.d.ts.map +0 -1
- package/interactors/chatModelInteractor.js +0 -93
- package/interactors/chatModelInteractor.js.map +0 -1
- package/interactors/chatModelInteractor.mjs +0 -89
- package/interactors/chatModelInteractor.mjs.map +0 -1
- package/interactors/chatModelsInteractor.d.mts +0 -12
- package/interactors/chatModelsInteractor.d.mts.map +0 -1
- package/interactors/chatModelsInteractor.d.ts +0 -12
- package/interactors/chatModelsInteractor.d.ts.map +0 -1
- package/interactors/chatModelsInteractor.js +0 -25
- package/interactors/chatModelsInteractor.js.map +0 -1
- package/interactors/chatModelsInteractor.mjs +0 -21
- package/interactors/chatModelsInteractor.mjs.map +0 -1
- package/interactors/chatSessionInteractor.d.mts +0 -26
- package/interactors/chatSessionInteractor.d.mts.map +0 -1
- package/interactors/chatSessionInteractor.d.ts +0 -26
- package/interactors/chatSessionInteractor.d.ts.map +0 -1
- package/interactors/chatSessionInteractor.js +0 -54
- package/interactors/chatSessionInteractor.js.map +0 -1
- package/interactors/chatSessionInteractor.mjs +0 -50
- package/interactors/chatSessionInteractor.mjs.map +0 -1
- package/interactors/downloadInteractor.d.mts +0 -16
- package/interactors/downloadInteractor.d.mts.map +0 -1
- package/interactors/downloadInteractor.d.ts +0 -16
- package/interactors/downloadInteractor.d.ts.map +0 -1
- package/interactors/downloadInteractor.js +0 -38
- package/interactors/downloadInteractor.js.map +0 -1
- package/interactors/downloadInteractor.mjs +0 -34
- package/interactors/downloadInteractor.mjs.map +0 -1
- package/interactors/engineInteractor.d.mts +0 -15
- package/interactors/engineInteractor.d.mts.map +0 -1
- package/interactors/engineInteractor.d.ts +0 -15
- package/interactors/engineInteractor.d.ts.map +0 -1
- package/interactors/engineInteractor.js +0 -30
- package/interactors/engineInteractor.js.map +0 -1
- package/interactors/engineInteractor.mjs +0 -26
- package/interactors/engineInteractor.mjs.map +0 -1
- package/interactors/interactor.d.mts +0 -6
- package/interactors/interactor.d.mts.map +0 -1
- package/interactors/interactor.d.ts +0 -6
- package/interactors/interactor.d.ts.map +0 -1
- package/interactors/interactor.js +0 -3
- package/interactors/interactor.js.map +0 -1
- package/interactors/interactor.mjs +0 -2
- package/interactors/interactor.mjs.map +0 -1
- package/napi/uzu.d.ts +0 -325
- package/napi/uzu.js +0 -121
- package/napi/uzu.mjs +0 -74
- package/src/bridging/asyncBatchSize.ts +0 -24
- package/src/bridging/chatSession.ts +0 -28
- package/src/bridging/classificationFeature.ts +0 -20
- package/src/bridging/classificationLabel.ts +0 -43
- package/src/bridging/classificationOutput.ts +0 -22
- package/src/bridging/classificationSession.ts +0 -17
- package/src/bridging/classificationStats.ts +0 -45
- package/src/bridging/config.ts +0 -122
- package/src/bridging/contextLength.ts +0 -29
- package/src/bridging/contextMode.ts +0 -31
- package/src/bridging/downloadHandle.ts +0 -41
- package/src/bridging/downloadProgressUpdate.ts +0 -21
- package/src/bridging/downloadState.ts +0 -62
- package/src/bridging/engine.ts +0 -141
- package/src/bridging/finishReason.ts +0 -6
- package/src/bridging/grammarConfig.ts +0 -40
- package/src/bridging/input.ts +0 -29
- package/src/bridging/licenseStatus.ts +0 -39
- package/src/bridging/message.ts +0 -50
- package/src/bridging/model.ts +0 -68
- package/src/bridging/modelKind.ts +0 -27
- package/src/bridging/modelType.ts +0 -32
- package/src/bridging/napi.ts +0 -3
- package/src/bridging/output.ts +0 -40
- package/src/bridging/parsedText.ts +0 -27
- package/src/bridging/prefillStepSize.ts +0 -32
- package/src/bridging/preset.ts +0 -48
- package/src/bridging/role.ts +0 -5
- package/src/bridging/runConfig.ts +0 -57
- package/src/bridging/runStats.ts +0 -17
- package/src/bridging/samplingMethod.ts +0 -49
- package/src/bridging/samplingPolicy.ts +0 -29
- package/src/bridging/samplingProcessingOrder.ts +0 -31
- package/src/bridging/samplingSeed.ts +0 -24
- package/src/bridging/stats.ts +0 -22
- package/src/bridging/stepStats.ts +0 -49
- package/src/bridging/text.ts +0 -18
- package/src/bridging/textToSpeechSession.ts +0 -15
- package/src/bridging/totalStats.ts +0 -20
- package/src/error.ts +0 -42
- package/src/interactors/chatModelInteractor.ts +0 -126
- package/src/interactors/chatModelsInteractor.ts +0 -29
- package/src/interactors/chatSessionInteractor.ts +0 -80
- package/src/interactors/downloadInteractor.ts +0 -47
- package/src/interactors/engineInteractor.ts +0 -38
- package/src/interactors/interactor.ts +0 -7
- package/src/napi/uzu.d.ts +0 -325
- package/src/napi/uzu.js +0 -121
- package/src/napi/uzu.mjs +0 -74
- package/src/utilities/env.ts +0 -9
- package/utilities/env.d.mts +0 -2
- package/utilities/env.d.mts.map +0 -1
- package/utilities/env.d.ts +0 -2
- package/utilities/env.d.ts.map +0 -1
- package/utilities/env.js +0 -14
- package/utilities/env.js.map +0 -1
- package/utilities/env.mjs +0 -10
- package/utilities/env.mjs.map +0 -1
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { AsyncBatchSize } from '../bridging/asyncBatchSize';
|
|
2
|
-
import { Config } from '../bridging/config';
|
|
3
|
-
import { ContextLength } from '../bridging/contextLength';
|
|
4
|
-
import { ContextMode } from '../bridging/contextMode';
|
|
5
|
-
import { DownloadProgressUpdate } from '../bridging/downloadProgressUpdate';
|
|
6
|
-
import { DownloadPhase } from '../bridging/downloadState';
|
|
7
|
-
import { Message } from '../bridging/message';
|
|
8
|
-
import { Model } from '../bridging/model';
|
|
9
|
-
import { ModelKind } from '../bridging/modelKind';
|
|
10
|
-
import { Output } from '../bridging/output';
|
|
11
|
-
import { PrefillStepSize } from '../bridging/prefillStepSize';
|
|
12
|
-
import { Preset } from '../bridging/preset';
|
|
13
|
-
import { RunConfig } from '../bridging/runConfig';
|
|
14
|
-
import { SamplingSeed } from '../bridging/samplingSeed';
|
|
15
|
-
import { ChatModelsInteractor } from './chatModelsInteractor';
|
|
16
|
-
import { ChatSessionInteractor } from './chatSessionInteractor';
|
|
17
|
-
import { DownloadInteractor } from './downloadInteractor';
|
|
18
|
-
import { Interactor, InteractorEntity } from './interactor';
|
|
19
|
-
|
|
20
|
-
export class ChatModelInteractor implements Interactor<Model> {
|
|
21
|
-
readonly modelsInteractor: ChatModelsInteractor;
|
|
22
|
-
readonly entity: InteractorEntity<Model>;
|
|
23
|
-
readonly config: Config;
|
|
24
|
-
|
|
25
|
-
constructor(modelsInteractor: ChatModelsInteractor, model: InteractorEntity<Model>, config: Config) {
|
|
26
|
-
this.modelsInteractor = modelsInteractor;
|
|
27
|
-
this.entity = model;
|
|
28
|
-
this.config = config;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async finalize(): Promise<Model> {
|
|
32
|
-
return await this.entity;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* Downloading */
|
|
36
|
-
|
|
37
|
-
downloading(): DownloadInteractor {
|
|
38
|
-
const handlePromise = (async () => {
|
|
39
|
-
const model = await this.finalize();
|
|
40
|
-
const engine = await this.modelsInteractor.engineInteractor.finalize();
|
|
41
|
-
const handle = engine.downloadHandle(model.repoId);
|
|
42
|
-
return handle;
|
|
43
|
-
})();
|
|
44
|
-
return new DownloadInteractor(this, handlePromise);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
download(callback?: (progressUpdate: DownloadProgressUpdate) => void): ChatModelInteractor {
|
|
48
|
-
const modelPromise = (async () => {
|
|
49
|
-
const downloadInteractor = this.downloading();
|
|
50
|
-
const handle = await downloadInteractor.finalize();
|
|
51
|
-
const state = await handle.state();
|
|
52
|
-
switch (state.phase) {
|
|
53
|
-
case DownloadPhase.Downloaded:
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
await downloadInteractor
|
|
57
|
-
.resume()
|
|
58
|
-
.onProgressUpdate(callback ?? (() => {}))
|
|
59
|
-
.finalize();
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return this.finalize();
|
|
63
|
-
})();
|
|
64
|
-
return new ChatModelInteractor(this.modelsInteractor, modelPromise, this.config);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/* Config */
|
|
68
|
-
|
|
69
|
-
preset(preset: Preset): ChatModelInteractor {
|
|
70
|
-
const config = this.config.withPreset(preset);
|
|
71
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
contextMode(contextMode: ContextMode): ChatModelInteractor {
|
|
75
|
-
const config = this.config.withContextMode(contextMode);
|
|
76
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
contextLength(contextLength: ContextLength): ChatModelInteractor {
|
|
80
|
-
const config = this.config.withContextLength(contextLength);
|
|
81
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
prefillStepSize(prefillStepSize: PrefillStepSize): ChatModelInteractor {
|
|
85
|
-
const config = this.config.withPrefillStepSize(prefillStepSize);
|
|
86
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
samplingSeed(samplingSeed: SamplingSeed): ChatModelInteractor {
|
|
90
|
-
const config = this.config.withSamplingSeed(samplingSeed);
|
|
91
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
asyncBatchSize(asyncBatchSize: AsyncBatchSize): ChatModelInteractor {
|
|
95
|
-
const config = this.config.withAsyncBatchSize(asyncBatchSize);
|
|
96
|
-
return new ChatModelInteractor(this.modelsInteractor, this.entity, config);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/* Session */
|
|
100
|
-
|
|
101
|
-
session(): ChatSessionInteractor {
|
|
102
|
-
const sessionPromise = (async () => {
|
|
103
|
-
const engine = await this.modelsInteractor.engineInteractor.finalize();
|
|
104
|
-
|
|
105
|
-
let model = await this.finalize();
|
|
106
|
-
if (model.kind === ModelKind.Local) {
|
|
107
|
-
model = await this.download().finalize();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const session = engine.chatSession(model, this.config);
|
|
111
|
-
return session;
|
|
112
|
-
})();
|
|
113
|
-
return new ChatSessionInteractor(this, sessionPromise, RunConfig.default());
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
async reply(text: string, progress: (partialOutput: Output) => boolean = () => true): Promise<Output> {
|
|
117
|
-
return await this.session().reply(text, progress);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async replyToMessages(
|
|
121
|
-
messages: Message[],
|
|
122
|
-
progress: (partialOutput: Output) => boolean = () => true,
|
|
123
|
-
): Promise<Output> {
|
|
124
|
-
return await this.session().replyToMessages(messages, progress);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Config } from '../bridging/config';
|
|
2
|
-
import { Model } from '../bridging/model';
|
|
3
|
-
import { EngineErrorCode, unwrapOrThrow } from '../error';
|
|
4
|
-
import { ChatModelInteractor } from './chatModelInteractor';
|
|
5
|
-
import { EngineInteractor } from './engineInteractor';
|
|
6
|
-
import { Interactor, InteractorEntity } from './interactor';
|
|
7
|
-
|
|
8
|
-
export class ChatModelsInteractor implements Interactor<Model[]> {
|
|
9
|
-
readonly engineInteractor: EngineInteractor;
|
|
10
|
-
readonly entity: InteractorEntity<Model[]>;
|
|
11
|
-
|
|
12
|
-
constructor(engineInteractor: EngineInteractor, models: InteractorEntity<Model[]>) {
|
|
13
|
-
this.engineInteractor = engineInteractor;
|
|
14
|
-
this.entity = models;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async finalize(): Promise<Model[]> {
|
|
18
|
-
return await this.entity;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
get(repoId: string): ChatModelInteractor {
|
|
22
|
-
const modelPromise = (async () => {
|
|
23
|
-
const models = await this.finalize();
|
|
24
|
-
const model = models.find((model) => model.repoId === repoId);
|
|
25
|
-
return unwrapOrThrow(model, EngineErrorCode.ModelNotFound);
|
|
26
|
-
})();
|
|
27
|
-
return new ChatModelInteractor(this, modelPromise, Config.default());
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { ChatSession } from '../bridging/chatSession';
|
|
2
|
-
import { GrammarConfig } from '../bridging/grammarConfig';
|
|
3
|
-
import { Input } from '../bridging/input';
|
|
4
|
-
import { Message } from '../bridging/message';
|
|
5
|
-
import { Output } from '../bridging/output';
|
|
6
|
-
import { RunConfig } from '../bridging/runConfig';
|
|
7
|
-
import { SamplingMethod } from '../bridging/samplingMethod';
|
|
8
|
-
import { SamplingPolicy } from '../bridging/samplingPolicy';
|
|
9
|
-
import { ChatModelInteractor } from './chatModelInteractor';
|
|
10
|
-
import { Interactor, InteractorEntity } from './interactor';
|
|
11
|
-
|
|
12
|
-
export class ChatSessionInteractor implements Interactor<ChatSession> {
|
|
13
|
-
readonly modelInteractor: ChatModelInteractor;
|
|
14
|
-
readonly entity: InteractorEntity<ChatSession>;
|
|
15
|
-
readonly config: RunConfig;
|
|
16
|
-
|
|
17
|
-
constructor(
|
|
18
|
-
modelInteractor: ChatModelInteractor,
|
|
19
|
-
session: InteractorEntity<ChatSession>,
|
|
20
|
-
config: RunConfig,
|
|
21
|
-
) {
|
|
22
|
-
this.modelInteractor = modelInteractor;
|
|
23
|
-
this.entity = session;
|
|
24
|
-
this.config = config;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async finalize(): Promise<ChatSession> {
|
|
28
|
-
return await this.entity;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/* Config */
|
|
32
|
-
|
|
33
|
-
tokensLimit(tokensLimit: number): ChatSessionInteractor {
|
|
34
|
-
const config = this.config.withTokensLimit(tokensLimit);
|
|
35
|
-
return new ChatSessionInteractor(this.modelInteractor, this.entity, config);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
enableThinking(enableThinking: boolean): ChatSessionInteractor {
|
|
39
|
-
const config = this.config.withEnableThinking(enableThinking);
|
|
40
|
-
return new ChatSessionInteractor(this.modelInteractor, this.entity, config);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
samplingPolicy(samplingPolicy: SamplingPolicy): ChatSessionInteractor {
|
|
44
|
-
const config = this.config.withSamplingPolicy(samplingPolicy);
|
|
45
|
-
return new ChatSessionInteractor(this.modelInteractor, this.entity, config);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
samplingMethod(samplingMethod: SamplingMethod): ChatSessionInteractor {
|
|
49
|
-
const config = this.config.withSamplingPolicy(SamplingPolicy.custom(samplingMethod));
|
|
50
|
-
return new ChatSessionInteractor(this.modelInteractor, this.entity, config);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
grammarConfig(grammarConfig: GrammarConfig | null): ChatSessionInteractor {
|
|
54
|
-
const config = this.config.withGrammarConfig(grammarConfig);
|
|
55
|
-
return new ChatSessionInteractor(this.modelInteractor, this.entity, config);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/* Run */
|
|
59
|
-
|
|
60
|
-
async run(input: Input, progress: (partialOutput: Output) => boolean = () => true): Promise<Output> {
|
|
61
|
-
const outputPromise = (async () => {
|
|
62
|
-
const session = await this.finalize();
|
|
63
|
-
const output = session.run(input, this.config, progress);
|
|
64
|
-
return output;
|
|
65
|
-
})();
|
|
66
|
-
const output = await outputPromise;
|
|
67
|
-
return output;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
async reply(text: string, progress: (partialOutput: Output) => boolean = () => true): Promise<Output> {
|
|
71
|
-
return await this.run(Input.text(text), progress);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
async replyToMessages(
|
|
75
|
-
messages: Message[],
|
|
76
|
-
progress: (partialOutput: Output) => boolean = () => true,
|
|
77
|
-
): Promise<Output> {
|
|
78
|
-
return await this.run(Input.messages(messages), progress);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { DownloadHandle } from '../bridging/downloadHandle';
|
|
2
|
-
import { DownloadProgressUpdate } from '../bridging/downloadProgressUpdate';
|
|
3
|
-
import { ChatModelInteractor } from './chatModelInteractor';
|
|
4
|
-
import { Interactor, InteractorEntity } from './interactor';
|
|
5
|
-
|
|
6
|
-
export class DownloadInteractor implements Interactor<DownloadHandle> {
|
|
7
|
-
readonly modelInteractor: ChatModelInteractor;
|
|
8
|
-
readonly entity: InteractorEntity<DownloadHandle>;
|
|
9
|
-
|
|
10
|
-
constructor(modelInteractor: ChatModelInteractor, handle: InteractorEntity<DownloadHandle>) {
|
|
11
|
-
this.modelInteractor = modelInteractor;
|
|
12
|
-
this.entity = handle;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async finalize(): Promise<DownloadHandle> {
|
|
16
|
-
return await this.entity;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
resume() {
|
|
20
|
-
return this.proxyHandleCall(async (handle) => await handle.download());
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
pause() {
|
|
24
|
-
return this.proxyHandleCall(async (handle) => await handle.pause());
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
delete() {
|
|
28
|
-
return this.proxyHandleCall(async (handle) => await handle.delete());
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
onProgressUpdate(callback: (progressUpdate: DownloadProgressUpdate) => void) {
|
|
32
|
-
return this.proxyHandleCall(async (handle) => {
|
|
33
|
-
for await (const update of handle.progressUpdate()) {
|
|
34
|
-
callback(update);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
private proxyHandleCall(callback: (handle: DownloadHandle) => Promise<void>): DownloadInteractor {
|
|
40
|
-
const handlePromise = (async () => {
|
|
41
|
-
const handle = await this.finalize();
|
|
42
|
-
await callback(handle);
|
|
43
|
-
return handle;
|
|
44
|
-
})();
|
|
45
|
-
return new DownloadInteractor(this.modelInteractor, handlePromise);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Engine } from '../bridging/engine';
|
|
2
|
-
import { ModelKind } from '../bridging/modelKind';
|
|
3
|
-
import { ChatModelInteractor } from './chatModelInteractor';
|
|
4
|
-
import { ChatModelsInteractor } from './chatModelsInteractor';
|
|
5
|
-
import { Interactor, InteractorEntity } from './interactor';
|
|
6
|
-
|
|
7
|
-
export class EngineInteractor implements Interactor<Engine> {
|
|
8
|
-
readonly entity: InteractorEntity<Engine>;
|
|
9
|
-
readonly modelKindFilter: ModelKind[] | null;
|
|
10
|
-
|
|
11
|
-
constructor(engine: InteractorEntity<Engine>, modelKindFilter: ModelKind[] | null = null) {
|
|
12
|
-
this.entity = engine;
|
|
13
|
-
this.modelKindFilter = modelKindFilter;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async finalize(): Promise<Engine> {
|
|
17
|
-
return await this.entity;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/* Models */
|
|
21
|
-
|
|
22
|
-
filterKinds(kinds: ModelKind[] | null): EngineInteractor {
|
|
23
|
-
return new EngineInteractor(this.entity, kinds);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
chatModels(): ChatModelsInteractor {
|
|
27
|
-
const modelsPromise = (async () => {
|
|
28
|
-
const engine = await this.finalize();
|
|
29
|
-
return await engine.chatModels(this.modelKindFilter);
|
|
30
|
-
})();
|
|
31
|
-
return new ChatModelsInteractor(this, modelsPromise);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
chatModel(repoId: string): ChatModelInteractor {
|
|
35
|
-
const models = this.chatModels();
|
|
36
|
-
return models.get(repoId);
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/napi/uzu.d.ts
DELETED
|
@@ -1,325 +0,0 @@
|
|
|
1
|
-
/* auto-generated by NAPI-RS */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
export declare class ChatSession {
|
|
4
|
-
run(input: Input, config: RunConfig, progress?: ((arg: Output) => boolean) | undefined | null): Output
|
|
5
|
-
reset(): void
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export declare class ClassificationSession {
|
|
9
|
-
run(input: Input): ClassificationOutput
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export declare class Engine {
|
|
13
|
-
activate(apiKey: string): Promise<LicenseStatus>
|
|
14
|
-
getChatModels(kinds: Array<ModelKind>): Promise<Array<Model>>
|
|
15
|
-
getTextToSpeechModels(): Promise<Array<Model>>
|
|
16
|
-
getClassificationModels(): Promise<Array<Model>>
|
|
17
|
-
getModelDownloadState(repoId: string): ModelDownloadState
|
|
18
|
-
createModelDownloadHandle(repoId: string): ModelDownloadHandle
|
|
19
|
-
benchmark(task: BenchmarksTask, prefillStepSize?: number | undefined | null): Promise<Array<BenchmarksResult>>
|
|
20
|
-
constructor()
|
|
21
|
-
createChatSession(model: Model, config: Config): ChatSession
|
|
22
|
-
createTextToSpeechSession(model: Model): TextToSpeechSession
|
|
23
|
-
createClassificationSession(model: Model): ClassificationSession
|
|
24
|
-
registerLicenseStatusHandler(callback?: ((arg: LicenseStatus) => void) | undefined | null): void
|
|
25
|
-
registerModelDownloadStateHandler(callback?: ((arg0: string, arg1: ModelDownloadState) => void) | undefined | null): void
|
|
26
|
-
registerModelsHandler(callback?: ((arg: Array<Model>) => void) | undefined | null): void
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export declare class ModelDownloadHandle {
|
|
30
|
-
identifier(): string
|
|
31
|
-
download(): Promise<void>
|
|
32
|
-
pause(): Promise<void>
|
|
33
|
-
delete(): Promise<void>
|
|
34
|
-
state(): Promise<ModelDownloadState>
|
|
35
|
-
progress(): AsyncIterable<ProgressUpdate>
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export declare class ProgressStream {
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export declare class ProgressUpdate {
|
|
43
|
-
/** Bytes downloaded so far. */
|
|
44
|
-
completedBytes: number
|
|
45
|
-
/** Total bytes expected for the download; `None` while unknown. */
|
|
46
|
-
totalBytes?: number
|
|
47
|
-
/** Normalised progress between 0.0 and 1.0. */
|
|
48
|
-
progress: number
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export declare class TextToSpeechSession {
|
|
52
|
-
run(input: Input, outputPath: string): void
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type AsyncBatchSize =
|
|
56
|
-
| { type: 'Default' }
|
|
57
|
-
| { type: 'Custom', size: number }
|
|
58
|
-
|
|
59
|
-
export interface BenchmarksDevice {
|
|
60
|
-
osName?: string
|
|
61
|
-
cpuName?: string
|
|
62
|
-
memoryTotal: number
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface BenchmarksResult {
|
|
66
|
-
task: BenchmarksTask
|
|
67
|
-
device: BenchmarksDevice
|
|
68
|
-
engineVersion: string
|
|
69
|
-
timestamp: number
|
|
70
|
-
precision?: DataType
|
|
71
|
-
memoryUsed?: number
|
|
72
|
-
tokensCountInput: number
|
|
73
|
-
tokensCountOutput: number
|
|
74
|
-
timeToFirstToken: number
|
|
75
|
-
promptTokensPerSecond: number
|
|
76
|
-
generateTokensPerSecond?: number
|
|
77
|
-
text: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface BenchmarksTask {
|
|
81
|
-
identifier: string
|
|
82
|
-
repoId: string
|
|
83
|
-
numberOfRuns: number
|
|
84
|
-
tokensLimit: number
|
|
85
|
-
messages: Array<Message>
|
|
86
|
-
greedy: boolean
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface ClassificationFeature {
|
|
90
|
-
name: string
|
|
91
|
-
values: Array<string>
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface ClassificationLabel {
|
|
95
|
-
index: number
|
|
96
|
-
label: string
|
|
97
|
-
title: string
|
|
98
|
-
description: string
|
|
99
|
-
recommendedThreshold: number
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface ClassificationOutput {
|
|
103
|
-
logits: Array<number>
|
|
104
|
-
probabilities: Record<string, number>
|
|
105
|
-
stats: ClassificationStats
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface ClassificationStats {
|
|
109
|
-
preprocessingDuration: number
|
|
110
|
-
forwardPassDuration: number
|
|
111
|
-
postprocessingDuration: number
|
|
112
|
-
totalDuration: number
|
|
113
|
-
tokensCount: number
|
|
114
|
-
tokensPerSecond: number
|
|
115
|
-
predictedLabel: string
|
|
116
|
-
confidence: number
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface Config {
|
|
120
|
-
preset: Preset
|
|
121
|
-
contextMode: ContextMode
|
|
122
|
-
contextLength: ContextLength
|
|
123
|
-
prefillStepSize: PrefillStepSize
|
|
124
|
-
samplingSeed: SamplingSeed
|
|
125
|
-
asyncBatchSize: AsyncBatchSize
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export type ContextLength =
|
|
129
|
-
| { type: 'Default' }
|
|
130
|
-
| { type: 'Maximal' }
|
|
131
|
-
| { type: 'Custom', length: number }
|
|
132
|
-
|
|
133
|
-
export type ContextMode =
|
|
134
|
-
| { type: 'None' }
|
|
135
|
-
| { type: 'Static', input: Input }
|
|
136
|
-
| { type: 'Dynamic' }
|
|
137
|
-
|
|
138
|
-
export declare const enum DataType {
|
|
139
|
-
BFloat16 = 0,
|
|
140
|
-
Float16 = 1,
|
|
141
|
-
Float32 = 2,
|
|
142
|
-
Int4 = 3,
|
|
143
|
-
Int8 = 4
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export declare const enum FinishReason {
|
|
147
|
-
Stop = 0,
|
|
148
|
-
Length = 1,
|
|
149
|
-
Cancelled = 2,
|
|
150
|
-
ContextLimitReached = 3
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export type GrammarConfig =
|
|
154
|
-
| { type: 'JsonSchema', schema: string }
|
|
155
|
-
| { type: 'Regex', pattern: string }
|
|
156
|
-
| { type: 'BuiltinJson' }
|
|
157
|
-
|
|
158
|
-
export type Input =
|
|
159
|
-
| { type: 'Text', text: string }
|
|
160
|
-
| { type: 'Messages', messages: Array<Message> }
|
|
161
|
-
|
|
162
|
-
export type LicenseStatus =
|
|
163
|
-
| { type: 'NotActivated' }
|
|
164
|
-
| { type: 'PaymentRequired' }
|
|
165
|
-
| { type: 'GracePeriodActive' }
|
|
166
|
-
| { type: 'Activated' }
|
|
167
|
-
| { type: 'NetworkError' }
|
|
168
|
-
| { type: 'InvalidApiKey' }
|
|
169
|
-
| { type: 'SignatureMismatch' }
|
|
170
|
-
| { type: 'Timeout' }
|
|
171
|
-
| { type: 'HttpError', code: number }
|
|
172
|
-
|
|
173
|
-
export interface Message {
|
|
174
|
-
role: Role
|
|
175
|
-
content: string
|
|
176
|
-
reasoningContent?: string
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export interface Model {
|
|
180
|
-
readonly repoId: string
|
|
181
|
-
readonly type: ModelType
|
|
182
|
-
readonly kind: ModelKind
|
|
183
|
-
readonly name: string
|
|
184
|
-
readonly vendor: string
|
|
185
|
-
readonly quantization?: string
|
|
186
|
-
readonly outputParserRegex?: string
|
|
187
|
-
readonly classificationLabels: Array<ClassificationLabel>
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export declare const enum ModelDownloadPhase {
|
|
191
|
-
NotDownloaded = 0,
|
|
192
|
-
Downloading = 1,
|
|
193
|
-
Paused = 2,
|
|
194
|
-
Downloaded = 3,
|
|
195
|
-
Locked = 4,
|
|
196
|
-
Error = 5
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface ModelDownloadState {
|
|
200
|
-
/** Total size of all model files in kilobytes. */
|
|
201
|
-
readonly totalKbytes: number
|
|
202
|
-
/** Bytes already downloaded (meaningful in Downloading / Paused). */
|
|
203
|
-
readonly downloadedKbytes: number
|
|
204
|
-
/** Current phase of the download. */
|
|
205
|
-
readonly phase: ModelDownloadPhase
|
|
206
|
-
/** Stringified error when `phase == ModelDownloadPhase::Error`. */
|
|
207
|
-
readonly error?: string
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
export declare const enum ModelKind {
|
|
211
|
-
Local = 0,
|
|
212
|
-
Cloud = 1
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export type ModelStorageError =
|
|
216
|
-
| { type: 'Io', message: string }
|
|
217
|
-
| { type: 'Network', message: string }
|
|
218
|
-
| { type: 'DownloadFailed', message: string }
|
|
219
|
-
| { type: 'Download', message: string }
|
|
220
|
-
| { type: 'InvalidPath', message: string }
|
|
221
|
-
| { type: 'ModelNotFound', identifier: string }
|
|
222
|
-
| { type: 'FileVerificationFailed', message: string }
|
|
223
|
-
| { type: 'Paused' }
|
|
224
|
-
|
|
225
|
-
export declare const enum ModelType {
|
|
226
|
-
Chat = 0,
|
|
227
|
-
Classification = 1,
|
|
228
|
-
TTS = 2
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export interface Output {
|
|
232
|
-
text: Text
|
|
233
|
-
stats: Stats
|
|
234
|
-
finishReason?: FinishReason
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface ParsedText {
|
|
238
|
-
chainOfThought?: string
|
|
239
|
-
response?: string
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
export type PrefillStepSize =
|
|
243
|
-
| { type: 'Default' }
|
|
244
|
-
| { type: 'Maximal' }
|
|
245
|
-
| { type: 'Custom', length: number }
|
|
246
|
-
|
|
247
|
-
export type Preset =
|
|
248
|
-
| { type: 'General' }
|
|
249
|
-
| { type: 'Classification', feature: ClassificationFeature }
|
|
250
|
-
| { type: 'Summarization' }
|
|
251
|
-
| { type: 'NGramSpeculator', useCase: string, numberOfSpeculatedTokens: number }
|
|
252
|
-
| { type: 'Chat' }
|
|
253
|
-
|
|
254
|
-
export declare const enum Role {
|
|
255
|
-
System = 0,
|
|
256
|
-
User = 1,
|
|
257
|
-
Assistant = 2
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface RunConfig {
|
|
261
|
-
tokensLimit: number
|
|
262
|
-
enableThinking: boolean
|
|
263
|
-
samplingPolicy: SamplingPolicy
|
|
264
|
-
grammarConfig?: GrammarConfig
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface RunStats {
|
|
268
|
-
count: bigint
|
|
269
|
-
averageDuration: number
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
export type SamplingMethod =
|
|
273
|
-
| { type: 'Greedy' }
|
|
274
|
-
| { type: 'Stochastic', temperature?: number, topK?: number, topP?: number, minP?: number, processingOrder: SamplingProcessingOrder }
|
|
275
|
-
|
|
276
|
-
export type SamplingPolicy =
|
|
277
|
-
| { type: 'Default' }
|
|
278
|
-
| { type: 'Custom', value: SamplingMethod }
|
|
279
|
-
|
|
280
|
-
export declare const enum SamplingProcessingOrder {
|
|
281
|
-
TemperatureThenFilters = 0,
|
|
282
|
-
FiltersThenTemperature = 1
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
export type SamplingSeed =
|
|
286
|
-
| { type: 'Default' }
|
|
287
|
-
| { type: 'Custom', seed: number }
|
|
288
|
-
|
|
289
|
-
export interface Stats {
|
|
290
|
-
prefillStats: StepStats
|
|
291
|
-
generateStats?: StepStats
|
|
292
|
-
totalStats: TotalStats
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export interface StepStats {
|
|
296
|
-
duration: number
|
|
297
|
-
suffixLength: bigint
|
|
298
|
-
tokensCount: bigint
|
|
299
|
-
tokensPerSecond: number
|
|
300
|
-
processedTokensPerSecond: number
|
|
301
|
-
modelRun: RunStats
|
|
302
|
-
run?: RunStats
|
|
303
|
-
speculatorProposed: bigint
|
|
304
|
-
speculatorAccepted: bigint
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export type StorageError =
|
|
308
|
-
| { type: 'ModelNotDownloaded' }
|
|
309
|
-
| { type: 'UnknownModel', repoId: string }
|
|
310
|
-
| { type: 'Storage', message: string }
|
|
311
|
-
| { type: 'MutexPoisoned', message: string }
|
|
312
|
-
| { type: 'LicenseNotActivated' }
|
|
313
|
-
|
|
314
|
-
export interface Text {
|
|
315
|
-
original: string
|
|
316
|
-
parsed: ParsedText
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export interface TotalStats {
|
|
320
|
-
duration: number
|
|
321
|
-
tokensCountInput: bigint
|
|
322
|
-
tokensCountOutput: bigint
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export declare function version(): string
|