@qvac/sdk 0.22.0 → 0.24.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/NOTICE +194 -97
- package/README.md +29 -470
- package/dist/examples/asr/parakeet-sortformer.js +24 -14
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.d.ts +2 -0
- package/dist/examples/asr/parakeet-transcribepsy-filesystem.js +105 -0
- package/dist/examples/asr/parakeet-unified-coreml.js +14 -9
- package/dist/examples/asr/whispercpp-prompt.js +9 -5
- package/dist/examples/assess-model-fit.d.ts +7 -9
- package/dist/examples/assess-model-fit.js +22 -43
- package/dist/examples/calc-tokens.d.ts +2 -0
- package/dist/examples/calc-tokens.js +21 -0
- package/dist/examples/classification/classify-image.js +11 -5
- package/dist/examples/completion-stop-reason.d.ts +3 -3
- package/dist/examples/completion-stop-reason.js +4 -4
- package/dist/examples/diffusion-flux3-klein.d.ts +2 -0
- package/dist/examples/diffusion-flux3-klein.js +102 -0
- package/dist/examples/diffusion-img2vid-ltx.js +7 -14
- package/dist/examples/diffusion-moss-image.d.ts +2 -0
- package/dist/examples/diffusion-moss-image.js +126 -0
- package/dist/examples/diffusion-qwen-image-21.d.ts +2 -0
- package/dist/examples/diffusion-qwen-image-21.js +115 -0
- package/dist/examples/diffusion-txt2vid-ltx.js +7 -14
- package/dist/examples/embed-multimodal.d.ts +2 -0
- package/dist/examples/embed-multimodal.js +80 -0
- package/dist/examples/embed-p2p.js +2 -2
- package/dist/examples/finetune/llamacpp-finetune.js +9 -4
- package/dist/examples/image/megaloc.d.ts +2 -0
- package/dist/examples/image/megaloc.js +37 -0
- package/dist/examples/llamacpp-multimodal.js +21 -1
- package/dist/examples/mcp-websearch.js +1 -1
- package/dist/examples/plugins.js +1 -1
- package/dist/examples/rag/rag-hyperdb/pipeline.js +2 -2
- package/dist/examples/rag/rag-turbovec.js +2 -2
- package/dist/examples/rerank.d.ts +2 -0
- package/dist/examples/rerank.js +33 -0
- package/dist/examples/sessions.d.ts +17 -0
- package/dist/examples/sessions.js +63 -0
- package/dist/examples/tools/llamacpp-deferred-tools.js +12 -8
- package/dist/examples/tools/llamacpp-tools-auto-dialect.js +4 -3
- package/dist/examples/tools/llamacpp-tools-gemma4.js +3 -3
- package/dist/examples/tools/llamacpp-tools-qwen35.js +4 -3
- package/dist/scripts/check-resource-collectors-packaging.js +7 -6
- package/dist/scripts/contract/build-contract.d.ts +2 -1
- package/dist/scripts/contract/build-contract.js +13 -1
- package/dist/scripts/contract/constants-registry.d.ts +19 -0
- package/dist/scripts/contract/constants-registry.js +9 -2
- package/dist/scripts/contract/method-shapes.d.ts +5 -0
- package/dist/scripts/contract/method-shapes.js +5 -0
- package/dist/scripts/enforce-inference-versions.d.ts +1 -1
- package/dist/scripts/enforce-inference-versions.js +28 -18
- package/dist/scripts/generate-bare-kit-runtimes.js +101 -69
- package/dist/src/client/api/assess-model-fit.d.ts +17 -17
- package/dist/src/client/api/assess-model-fit.js +19 -32
- package/dist/src/client/api/audio-edit.d.ts +5 -3
- package/dist/src/client/api/audio-edit.js +7 -5
- package/dist/src/client/api/audio-gen-result.js +136 -47
- package/dist/src/client/api/audio-gen.d.ts +40 -3
- package/dist/src/client/api/audio-gen.js +42 -5
- package/dist/src/client/api/audio-understand.d.ts +2 -2
- package/dist/src/client/api/audio-understand.js +4 -4
- package/dist/src/client/api/batch-completion.js +4 -3
- package/dist/src/client/api/bci-transcribe.js +3 -3
- package/dist/src/client/api/calc-tokens.d.ts +33 -0
- package/dist/src/client/api/calc-tokens.js +44 -0
- package/dist/src/client/api/cancel.d.ts +2 -2
- package/dist/src/client/api/cancel.js +3 -3
- package/dist/src/client/api/classify.d.ts +12 -5
- package/dist/src/client/api/classify.js +18 -6
- package/dist/src/client/api/client-request-id.d.ts +0 -15
- package/dist/src/client/api/client-request-id.js +15 -12
- package/dist/src/client/api/completion-stream.d.ts +9 -1
- package/dist/src/client/api/completion-stream.js +14 -3
- package/dist/src/client/api/decide.d.ts +1 -1
- package/dist/src/client/api/decide.js +3 -3
- package/dist/src/client/api/delete-cache.d.ts +9 -2
- package/dist/src/client/api/delete-cache.js +14 -4
- package/dist/src/client/api/diffusion.d.ts +38 -5
- package/dist/src/client/api/diffusion.js +42 -7
- package/dist/src/client/api/download-asset.js +3 -3
- package/dist/src/client/api/embed.d.ts +82 -29
- package/dist/src/client/api/embed.js +66 -21
- package/dist/src/client/api/finetune.js +3 -3
- package/dist/src/client/api/get-loaded-model-info.js +1 -1
- package/dist/src/client/api/get-model-info.d.ts +2 -2
- package/dist/src/client/api/get-model-info.js +3 -3
- package/dist/src/client/api/get-system-resources.d.ts +2 -2
- package/dist/src/client/api/get-system-resources.js +3 -3
- package/dist/src/client/api/heartbeat.d.ts +3 -2
- package/dist/src/client/api/heartbeat.js +4 -3
- package/dist/src/client/api/index.d.ts +8 -6
- package/dist/src/client/api/index.js +6 -4
- package/dist/src/client/api/invoke-plugin.d.ts +8 -2
- package/dist/src/client/api/invoke-plugin.js +18 -3
- package/dist/src/client/api/load-model.js +9 -6
- package/dist/src/client/api/logging-stream.d.ts +11 -2
- package/dist/src/client/api/logging-stream.js +12 -3
- package/dist/src/client/api/ocr.d.ts +5 -3
- package/dist/src/client/api/ocr.js +45 -22
- package/dist/src/client/api/rag.d.ts +1 -1
- package/dist/src/client/api/rag.js +3 -3
- package/dist/src/client/api/registry.d.ts +19 -8
- package/dist/src/client/api/registry.js +43 -17
- package/dist/src/client/api/rerank.d.ts +22 -0
- package/dist/src/client/api/rerank.js +39 -0
- package/dist/src/client/api/resume.d.ts +2 -1
- package/dist/src/client/api/resume.js +3 -3
- package/dist/src/client/api/rpc-server.d.ts +4 -4
- package/dist/src/client/api/rpc-server.js +12 -12
- package/dist/src/client/api/state.d.ts +2 -2
- package/dist/src/client/api/state.js +3 -3
- package/dist/src/client/api/subscribe-logs.d.ts +2 -2
- package/dist/src/client/api/subscribe-logs.js +4 -3
- package/dist/src/client/api/suspend.d.ts +4 -2
- package/dist/src/client/api/suspend.js +5 -4
- package/dist/src/client/api/text-to-speech.d.ts +14 -5
- package/dist/src/client/api/text-to-speech.js +86 -32
- package/dist/src/client/api/transcribe.d.ts +7 -3
- package/dist/src/client/api/transcribe.js +9 -3
- package/dist/src/client/api/translate.js +2 -2
- package/dist/src/client/api/unload-model.d.ts +19 -7
- package/dist/src/client/api/unload-model.js +31 -13
- package/dist/src/client/api/upscale.d.ts +6 -3
- package/dist/src/client/api/upscale.js +10 -5
- package/dist/src/client/api/vector-index.d.ts +51 -17
- package/dist/src/client/api/vector-index.js +101 -49
- package/dist/src/client/api/video-request.d.ts +5 -5
- package/dist/src/client/api/video.d.ts +3 -2
- package/dist/src/client/api/video.js +6 -5
- package/dist/src/client/api/vla.d.ts +9 -5
- package/dist/src/client/api/vla.js +17 -8
- package/dist/src/client/api/world-result.js +2 -2
- package/dist/src/client/api/world.d.ts +6 -6
- package/dist/src/client/api/world.js +6 -6
- package/dist/src/client/init-hooks.d.ts +6 -4
- package/dist/src/client/init-hooks.js +12 -15
- package/dist/src/client/logging-stream-registry.d.ts +6 -3
- package/dist/src/client/logging-stream-registry.js +36 -14
- package/dist/src/client/plugins-factory.d.ts +1 -1
- package/dist/src/client/plugins-factory.js +1 -1
- package/dist/src/client/rpc/bundle-stamp.d.ts +29 -0
- package/dist/src/client/rpc/bundle-stamp.js +75 -0
- package/dist/src/client/rpc/expo-home-dir.d.ts +2 -0
- package/dist/src/client/rpc/expo-home-dir.js +4 -0
- package/dist/src/client/rpc/expo-rpc-client.js +192 -138
- package/dist/src/client/rpc/node-rpc-client.js +324 -426
- package/dist/src/client/rpc/pear-runtime.d.ts +12 -0
- package/dist/src/client/rpc/pear-runtime.js +12 -0
- package/dist/src/client/rpc/rpc-client.d.ts +6 -4
- package/dist/src/client/rpc/rpc-client.js +168 -31
- package/dist/src/client/rpc/rpc-error.js +24 -2
- package/dist/src/client/rpc/unbundled-harness.d.ts +16 -0
- package/dist/src/client/rpc/unbundled-harness.js +27 -0
- package/dist/src/client/rpc/worker-failure.d.ts +27 -0
- package/dist/src/client/rpc/worker-failure.js +61 -0
- package/dist/src/client/session-registry.d.ts +75 -0
- package/dist/src/client/session-registry.js +149 -0
- package/dist/src/client/session.d.ts +125 -0
- package/dist/src/client/session.js +148 -0
- package/dist/src/commands/bundle/addons.d.ts +14 -0
- package/dist/src/commands/bundle/addons.js +65 -0
- package/dist/src/commands/bundle/constants.js +2 -0
- package/dist/src/commands/bundle/entry-gen.d.ts +1 -5
- package/dist/src/commands/bundle/entry-gen.js +18 -51
- package/dist/src/commands/bundle/index.d.ts +60 -14
- package/dist/src/commands/bundle/index.js +350 -126
- package/dist/src/commands/bundle/link.d.ts +58 -0
- package/dist/src/commands/bundle/link.js +135 -0
- package/dist/src/commands/bundle/node-support.d.ts +13 -0
- package/dist/src/commands/bundle/node-support.js +23 -0
- package/dist/src/commands/bundle/plugins.js +1 -1
- package/dist/src/commands/bundle/read-bundle.d.ts +9 -0
- package/dist/src/commands/bundle/read-bundle.js +27 -0
- package/dist/src/commands/bundle/resolve-sdk-import.d.ts +6 -0
- package/dist/src/commands/bundle/resolve-sdk-import.js +24 -28
- package/dist/src/commands/bundle/scratch.d.ts +35 -0
- package/dist/src/commands/bundle/scratch.js +178 -0
- package/dist/src/commands/bundle/targets.d.ts +14 -0
- package/dist/src/commands/bundle/targets.js +37 -0
- package/dist/src/commands/host-prebuilds/index.d.ts +8 -7
- package/dist/src/commands/host-prebuilds/index.js +13 -11
- package/dist/src/commands/index.d.ts +13 -12
- package/dist/src/commands/index.js +7 -7
- package/dist/src/commands/verify/abi.d.ts +21 -15
- package/dist/src/commands/verify/abi.js +12 -80
- package/dist/src/commands/verify/bare-kit-runtime.d.ts +20 -22
- package/dist/src/commands/verify/bare-kit-runtime.js +102 -150
- package/dist/src/commands/verify/bare-kit-runtimes.d.ts +10 -9
- package/dist/src/commands/verify/bare-kit-runtimes.js +21 -21
- package/dist/src/commands/verify/bundle-source.d.ts +1 -1
- package/dist/src/commands/verify/bundle-source.js +27 -23
- package/dist/src/commands/verify/engines-advice.d.ts +6 -12
- package/dist/src/commands/verify/engines-advice.js +9 -56
- package/dist/src/commands/verify/index.d.ts +34 -33
- package/dist/src/commands/verify/index.js +96 -204
- package/dist/src/commands/verify/node-modules-source.d.ts +1 -1
- package/dist/src/commands/verify/node-modules-source.js +1 -1
- package/dist/src/commands/verify/prebuilds.d.ts +4 -6
- package/dist/src/commands/verify/prebuilds.js +3 -4
- package/dist/src/commands/verify/resource-collectors.d.ts +0 -6
- package/dist/src/commands/verify/resource-collectors.js +3 -52
- package/dist/src/commands/verify/sidecar-runtime.d.ts +6 -0
- package/dist/src/commands/verify/sidecar-runtime.js +51 -0
- package/dist/src/expo/plugins/get-project-root.d.ts +1 -1
- package/dist/src/expo/plugins/withAndroidArchitecture.d.ts +1 -1
- package/dist/src/expo/plugins/withAndroidNdkVersion.d.ts +1 -1
- package/dist/src/expo/plugins/withAndroidNdkVersion.js +16 -10
- package/dist/src/expo/plugins/withBareKit.d.ts +59 -0
- package/dist/src/expo/plugins/withBareKit.js +204 -0
- package/dist/src/expo/plugins/withDeviceInfo.d.ts +1 -1
- package/dist/src/expo/plugins/withDeviceInfo.js +19 -5
- package/dist/src/expo/plugins/withMobileBundle.d.ts +5 -12
- package/dist/src/expo/plugins/withMobileBundle.js +38 -59
- package/dist/src/expo/plugins/withOpenCL.d.ts +1 -1
- package/dist/src/expo/plugins/withQvacSDK.d.ts +2 -1
- package/dist/src/expo/plugins/withQvacSDK.js +3 -0
- package/dist/src/index.d.ts +6 -5
- package/dist/src/index.js +10 -14
- package/dist/src/logging/addon.d.ts +1 -1
- package/dist/src/logging/base-logger.js +1 -1
- package/dist/src/logging/utils.js +11 -3
- package/dist/src/plugin-ids.d.ts +3 -1
- package/dist/src/plugin-ids.js +4 -0
- package/dist/src/schemas/public.d.ts +1 -1
- package/dist/src/schemas/public.js +1 -1
- package/dist/src/schemas/sdk-errors-client.d.ts +5 -6
- package/dist/src/schemas/sdk-errors-client.js +30 -36
- package/dist/src/schemas/sdk-errors-server.d.ts +12 -1
- package/dist/src/schemas/sdk-errors-server.js +65 -2
- package/dist/src/server/rpc/rpc-utils.d.ts +26 -0
- package/dist/src/server/rpc/rpc-utils.js +41 -0
- package/dist/src/utils/aggregate-events.d.ts +1 -1
- package/dist/src/utils/aggregate-events.js +2 -2
- package/dist/src/utils/errors-client.d.ts +37 -29
- package/dist/src/utils/errors-client.js +50 -41
- package/dist/src/utils/errors-server.d.ts +65 -1
- package/dist/src/utils/errors-server.js +122 -1
- package/dist/src/utils/mcp-adapter.d.ts +1 -1
- package/dist/src/utils/mcp-adapter.js +1 -1
- package/dist/src/utils/tool-helpers.js +1 -1
- package/dist/src/utils/withTimeout.js +34 -17
- package/dist/src/worker/handle-request.js +26 -21
- package/dist/src/worker/handler-utils.d.ts +2 -6
- package/dist/src/worker/handler-utils.js +2 -20
- package/dist/src/worker/index.d.ts +2 -4
- package/dist/src/worker/index.js +24 -34
- package/dist/src/worker/plugins/ggml-image-embedding.d.ts +2 -0
- package/dist/src/worker/plugins/ggml-image-embedding.js +1 -0
- package/dist/src/worker/plugins/llamacpp-rerank.d.ts +2 -0
- package/dist/src/worker/plugins/llamacpp-rerank.js +1 -0
- package/dist/src/worker/shim.d.ts +4 -0
- package/dist/src/worker/shim.js +7 -0
- package/dist/src/worker/start.d.ts +9 -0
- package/dist/src/worker/start.js +16 -0
- package/dist/src/worker/unbundled-shim.d.ts +2 -0
- package/dist/src/worker/unbundled-shim.js +4 -0
- package/docs/system-resources-support-matrix.md +27 -19
- package/package.json +91 -74
- package/src/electron-forge/index.cjs +65 -91
- package/dist/examples/model-fit-ui/server.d.ts +0 -24
- package/dist/examples/model-fit-ui/server.js +0 -221
- package/dist/src/client/rpc/ensure-worker-ready.d.ts +0 -9
- package/dist/src/client/rpc/ensure-worker-ready.js +0 -17
- package/dist/src/client/rpc/init-timeout.d.ts +0 -26
- package/dist/src/client/rpc/init-timeout.js +0 -25
- package/dist/src/client/rpc/worker-startup-error.d.ts +0 -12
- package/dist/src/client/rpc/worker-startup-error.js +0 -13
- package/dist/src/commands/bundle/bare-pack.d.ts +0 -21
- package/dist/src/commands/bundle/bare-pack.js +0 -77
- package/dist/src/commands/bundle/manifest.d.ts +0 -25
- package/dist/src/commands/bundle/manifest.js +0 -192
- package/dist/src/expo/plugins/link-addons.d.ts +0 -18
- package/dist/src/expo/plugins/link-addons.js +0 -65
- package/dist/src/pear/pre.d.ts +0 -21
- package/dist/src/pear/pre.js +0 -448
- package/dist/src/server/env.d.ts +0 -22
- package/dist/src/server/env.js +0 -59
- package/dist/src/server/utils/qvac-paths.d.ts +0 -2
- package/dist/src/server/utils/qvac-paths.js +0 -5
- package/dist/src/server/utils/worker-lock.d.ts +0 -3
- package/dist/src/server/utils/worker-lock.js +0 -67
- package/dist/src/worker/create-server.d.ts +0 -8
- package/dist/src/worker/create-server.js +0 -51
- package/dist/src/worker/lifecycle.d.ts +0 -23
- package/dist/src/worker/lifecycle.js +0 -149
|
@@ -1,42 +1,60 @@
|
|
|
1
1
|
import { isBare } from 'which-runtime';
|
|
2
2
|
import {} from '@qvac/inference/surface';
|
|
3
|
-
import { send, close } from '
|
|
4
|
-
import { stopLoggingStreamForModel } from '
|
|
3
|
+
import { send, close } from '../../client/rpc/rpc-client.js';
|
|
4
|
+
import { stopLoggingStreamForModel } from '../../client/logging-stream-registry.js';
|
|
5
|
+
import { hasClientSessions, releaseHeldModel } from '../../client/session-registry.js';
|
|
5
6
|
import { InvalidResponseError, ModelUnloadFailedError } from '../../utils/errors-client.js';
|
|
6
7
|
import { getClientLogger } from '../../logging/index.js';
|
|
7
8
|
const logger = getClientLogger();
|
|
8
9
|
/**
|
|
9
|
-
*
|
|
10
|
+
* Releases the caller's hold on a loaded model. The model leaves memory once
|
|
11
|
+
* no caller session holds it; a session that shares the model with another
|
|
12
|
+
* only drops its own lease.
|
|
10
13
|
*
|
|
11
|
-
* When the last model
|
|
12
|
-
* automatically closes the RPC connection on Node/Electron, allowing
|
|
13
|
-
* process to exit naturally without requiring manual cleanup. On Bare the
|
|
14
|
+
* When the owner unloads the last model and no caller session is open, this
|
|
15
|
+
* function automatically closes the RPC connection on Node/Electron, allowing
|
|
16
|
+
* the process to exit naturally without requiring manual cleanup. On Bare the
|
|
14
17
|
* connection is left open by default so long-lived workers survive a routine
|
|
15
|
-
* unload; pass `autoClose: true` to opt in to closing.
|
|
18
|
+
* unload; pass `autoClose: true` to opt in to closing. A session never closes
|
|
19
|
+
* the runtime.
|
|
16
20
|
*
|
|
17
21
|
* @param params - The parameters for unloading the model
|
|
18
22
|
* @param params.modelId - The unique identifier of the model to unload
|
|
19
23
|
* @param params.clearStorage - Whether to clear the storage for the model
|
|
20
24
|
* @param params.autoClose - Override the runtime-default auto-close behavior
|
|
25
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection).
|
|
21
26
|
* @throws {QvacErrorBase} When the response type is invalid or when the unload operation fails
|
|
22
27
|
*/
|
|
23
|
-
export async function unloadModel(params) {
|
|
28
|
+
export async function unloadModel(params, options) {
|
|
29
|
+
return createUnloadModelCall(params, options);
|
|
30
|
+
}
|
|
31
|
+
export async function createUnloadModelCall(params, options, sendRequest = send, closeRuntime = close) {
|
|
24
32
|
const request = {
|
|
25
33
|
type: 'unloadModel',
|
|
26
34
|
modelId: params.modelId,
|
|
27
35
|
clearStorage: params.clearStorage ?? false
|
|
28
36
|
};
|
|
29
|
-
const response = await
|
|
37
|
+
const response = await sendRequest(request, options);
|
|
30
38
|
if (response.type !== 'unloadModel') {
|
|
31
39
|
throw new InvalidResponseError('unloadModel');
|
|
32
40
|
}
|
|
33
41
|
if (!response.success) {
|
|
34
42
|
throw new ModelUnloadFailedError(params.modelId);
|
|
35
43
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
if (response.released !== false) {
|
|
45
|
+
stopLoggingStreamForModel(params.modelId, options);
|
|
46
|
+
releaseHeldModel(options, params.modelId);
|
|
47
|
+
}
|
|
48
|
+
const isOwnerCall = options?.sessionId === undefined;
|
|
49
|
+
const shouldAutoClose = isOwnerCall && (params.autoClose ?? !isBare);
|
|
50
|
+
// The worker's count misses a session this client began opening while the
|
|
51
|
+
// unload was in flight; the client registry records it at `openSession()`.
|
|
52
|
+
if (shouldAutoClose &&
|
|
53
|
+
response.hasActiveModels === false &&
|
|
54
|
+
response.hasOpenSessions !== true &&
|
|
55
|
+
!hasClientSessions()) {
|
|
39
56
|
logger.info('🧹 No models active, automatically closing RPC connection...');
|
|
40
|
-
await
|
|
57
|
+
await closeRuntime();
|
|
41
58
|
}
|
|
59
|
+
return { released: response.released ?? true, unloaded: response.unloaded ?? true };
|
|
42
60
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { type UpscaleClientParams, type UpscaleStats } from '@qvac/inference/surface';
|
|
1
|
+
import { type UpscaleClientParams, type UpscaleStats, type RPCOptions } from '@qvac/inference/surface';
|
|
2
2
|
interface UpscaleResult {
|
|
3
|
+
/** Stable id of this run; pass to `cancel({ requestId })` to stop delivery. */
|
|
4
|
+
requestId: string;
|
|
3
5
|
outputs: Promise<Uint8Array[]>;
|
|
4
6
|
stats: Promise<UpscaleStats | undefined>;
|
|
5
7
|
}
|
|
@@ -18,7 +20,8 @@ interface UpscaleResult {
|
|
|
18
20
|
*
|
|
19
21
|
* @param params - `{ modelId, image, repeats? }`. `image` is raw PNG/JPEG
|
|
20
22
|
* bytes; the client base64-encodes them on the wire.
|
|
21
|
-
* @
|
|
23
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection).
|
|
24
|
+
* @returns `{ requestId, outputs, stats }` — `outputs` resolves to a single-element
|
|
22
25
|
* array containing the final upscaled PNG; `stats` resolves to
|
|
23
26
|
* addon-side stats (load/upscale ms, final width/height, repeats
|
|
24
27
|
* actually executed, etc.).
|
|
@@ -40,6 +43,6 @@ interface UpscaleResult {
|
|
|
40
43
|
* console.log(await stats);
|
|
41
44
|
* ```
|
|
42
45
|
*/
|
|
43
|
-
export declare function upscale(params: UpscaleClientParams): UpscaleResult;
|
|
46
|
+
export declare function upscale(params: UpscaleClientParams, options?: RPCOptions): UpscaleResult;
|
|
44
47
|
export {};
|
|
45
48
|
//# sourceMappingURL=upscale.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { upscaleStreamResponseSchema } from '@qvac/inference/surface';
|
|
2
|
-
import { stream as streamRpc } from '
|
|
2
|
+
import { stream as streamRpc } from '../../client/rpc/rpc-client.js';
|
|
3
|
+
import { generateClientRequestId } from '../../client/api/client-request-id.js';
|
|
3
4
|
import { decodeBase64, encodeBase64 } from '../../utils/encoding.js';
|
|
4
5
|
import { StreamEndedError } from '../../utils/errors-client.js';
|
|
5
6
|
/**
|
|
@@ -17,7 +18,8 @@ import { StreamEndedError } from '../../utils/errors-client.js';
|
|
|
17
18
|
*
|
|
18
19
|
* @param params - `{ modelId, image, repeats? }`. `image` is raw PNG/JPEG
|
|
19
20
|
* bytes; the client base64-encodes them on the wire.
|
|
20
|
-
* @
|
|
21
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection).
|
|
22
|
+
* @returns `{ requestId, outputs, stats }` — `outputs` resolves to a single-element
|
|
21
23
|
* array containing the final upscaled PNG; `stats` resolves to
|
|
22
24
|
* addon-side stats (load/upscale ms, final width/height, repeats
|
|
23
25
|
* actually executed, etc.).
|
|
@@ -39,12 +41,14 @@ import { StreamEndedError } from '../../utils/errors-client.js';
|
|
|
39
41
|
* console.log(await stats);
|
|
40
42
|
* ```
|
|
41
43
|
*/
|
|
42
|
-
export function upscale(params) {
|
|
44
|
+
export function upscale(params, options) {
|
|
45
|
+
const requestId = generateClientRequestId();
|
|
43
46
|
const request = {
|
|
44
47
|
modelId: params.modelId,
|
|
45
48
|
image: encodeBase64(params.image),
|
|
46
49
|
...(params.repeats !== undefined && { repeats: params.repeats }),
|
|
47
|
-
type: 'upscaleStream'
|
|
50
|
+
type: 'upscaleStream',
|
|
51
|
+
requestId
|
|
48
52
|
};
|
|
49
53
|
let statsResolver = () => { };
|
|
50
54
|
let statsRejecter = () => { };
|
|
@@ -64,7 +68,7 @@ export function upscale(params) {
|
|
|
64
68
|
async function processResponses() {
|
|
65
69
|
let sawDone = false;
|
|
66
70
|
try {
|
|
67
|
-
for await (const response of streamRpc(request)) {
|
|
71
|
+
for await (const response of streamRpc(request, options)) {
|
|
68
72
|
if (response &&
|
|
69
73
|
typeof response === 'object' &&
|
|
70
74
|
'type' in response &&
|
|
@@ -93,6 +97,7 @@ export function upscale(params) {
|
|
|
93
97
|
}
|
|
94
98
|
void processResponses();
|
|
95
99
|
return {
|
|
100
|
+
requestId,
|
|
96
101
|
outputs: outputsPromise,
|
|
97
102
|
stats: statsPromise
|
|
98
103
|
};
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import { send } from '
|
|
2
|
-
import { type CreateVectorIndexParams, type LoadVectorIndexParams, type RPCOptions, type VectorIndexAddParams, type VectorIndexHit, type VectorIndexIdsParams, type VectorIndexStorage, type VectorIndexWriteParams } from '@qvac/inference/surface';
|
|
1
|
+
import { send } from '../../client/rpc/rpc-client.js';
|
|
2
|
+
import { type CreateVectorIndexParams, type LoadVectorIndexParams, type RPCOptions, type VectorIndexAddParams, type VectorIndexHit, type VectorIndexIdsParams, type VectorIndexSetStagedSearchParams, type VectorIndexStorage, type VectorIndexWriteParams } from '@qvac/inference/surface';
|
|
3
|
+
/**
|
|
4
|
+
* A pending index operation. `requestId` is readable before the promise
|
|
5
|
+
* settles, so the operation can be targeted with `cancel({ requestId })`.
|
|
6
|
+
*/
|
|
7
|
+
export type VectorIndexOperation<T> = Promise<T> & {
|
|
8
|
+
requestId: string;
|
|
9
|
+
};
|
|
3
10
|
/**
|
|
4
11
|
* A handle to a vector index that lives in worker memory.
|
|
5
12
|
*
|
|
@@ -13,6 +20,10 @@ import { type CreateVectorIndexParams, type LoadVectorIndexParams, type RPCOptio
|
|
|
13
20
|
* shutdown. After a worker crash or restart every method rejects with
|
|
14
21
|
* `VECTOR_INDEX_NOT_FOUND`; recover by creating a new index or loading a
|
|
15
22
|
* snapshot written earlier with `write()`.
|
|
23
|
+
*
|
|
24
|
+
* A handle opened through a session keeps that session: every call it makes
|
|
25
|
+
* runs as the session, is swept by the session's close, and is refused once
|
|
26
|
+
* the session ended.
|
|
16
27
|
*/
|
|
17
28
|
export interface VectorIndex {
|
|
18
29
|
/** Opaque id of the worker-side index; useful in logs, not needed for any call. */
|
|
@@ -27,12 +38,34 @@ export interface VectorIndex {
|
|
|
27
38
|
readonly storage: VectorIndexStorage | undefined;
|
|
28
39
|
/** Number of live entries as of the last call that changed or reported it. */
|
|
29
40
|
readonly length: number;
|
|
41
|
+
/**
|
|
42
|
+
* TQ+ calibration state as of create, load, or the last successful add.
|
|
43
|
+
* Undefined when an external provider does not report calibration.
|
|
44
|
+
*/
|
|
45
|
+
readonly calibrated: boolean | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Staged search setting as of the last successful call that reported it.
|
|
48
|
+
* Undefined when an external provider does not report the setting.
|
|
49
|
+
*/
|
|
50
|
+
readonly stagedSearch: boolean | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Turns TurboVec staged search on or off. Off on every new or loaded index.
|
|
53
|
+
* On supported hosts, dimensions divisible by 32 and at least 32,768 entries
|
|
54
|
+
* use a shortlist for faster searches with lower recall. Other dimensions
|
|
55
|
+
* and v3 snapshots retain the setting but scan in full. The setting is not
|
|
56
|
+
* saved in snapshots. Rejects non-TurboVec storage or unsupported providers.
|
|
57
|
+
*/
|
|
58
|
+
setStagedSearch(params: VectorIndexSetStagedSearchParams, options?: RPCOptions): VectorIndexOperation<{
|
|
59
|
+
stagedSearch: boolean;
|
|
60
|
+
}>;
|
|
30
61
|
/**
|
|
31
62
|
* Adds vectors under the given ids in one atomic batch. Rejects duplicate
|
|
32
63
|
* ids, ids equal to 2^64 - 1, and rows whose length differs from `dim`.
|
|
64
|
+
* A fresh TurboVec index attempts calibration from a first batch of at
|
|
65
|
+
* least 1,000 vectors. A smaller first batch leaves it uncalibrated.
|
|
33
66
|
* @returns The number of live entries after the add.
|
|
34
67
|
*/
|
|
35
|
-
add(params: VectorIndexAddParams, options?: RPCOptions):
|
|
68
|
+
add(params: VectorIndexAddParams, options?: RPCOptions): VectorIndexOperation<{
|
|
36
69
|
length: number;
|
|
37
70
|
}>;
|
|
38
71
|
/**
|
|
@@ -44,7 +77,7 @@ export interface VectorIndex {
|
|
|
44
77
|
search(params: {
|
|
45
78
|
query: number[];
|
|
46
79
|
k: number;
|
|
47
|
-
}, options?: RPCOptions):
|
|
80
|
+
}, options?: RPCOptions): VectorIndexOperation<VectorIndexHit[]>;
|
|
48
81
|
/**
|
|
49
82
|
* Finds the `k` nearest entries to each query row; one hit list per row.
|
|
50
83
|
* @overloadLabel "Multiple queries"
|
|
@@ -52,35 +85,36 @@ export interface VectorIndex {
|
|
|
52
85
|
search(params: {
|
|
53
86
|
queries: number[][];
|
|
54
87
|
k: number;
|
|
55
|
-
}, options?: RPCOptions):
|
|
88
|
+
}, options?: RPCOptions): VectorIndexOperation<VectorIndexHit[][]>;
|
|
56
89
|
/**
|
|
57
90
|
* Removes ids; each boolean tells whether that id was present. Ids are
|
|
58
91
|
* applied in order, so a rejection leaves the ids before the failure
|
|
59
92
|
* removed and `length` reporting the last successful call.
|
|
60
93
|
*/
|
|
61
|
-
remove(params: VectorIndexIdsParams, options?: RPCOptions):
|
|
94
|
+
remove(params: VectorIndexIdsParams, options?: RPCOptions): VectorIndexOperation<boolean[]>;
|
|
62
95
|
/** Reports, per id, whether the index holds it. */
|
|
63
|
-
contains(params: VectorIndexIdsParams, options?: RPCOptions):
|
|
96
|
+
contains(params: VectorIndexIdsParams, options?: RPCOptions): VectorIndexOperation<boolean[]>;
|
|
64
97
|
/**
|
|
65
98
|
* Writes a checksummed snapshot to `path`, replacing any existing file.
|
|
66
99
|
* An absolute path is used as given; a relative path resolves under the
|
|
67
100
|
* QVAC data directory. Load it later with `loadVectorIndex`.
|
|
68
101
|
* @returns The resolved absolute path.
|
|
69
102
|
*/
|
|
70
|
-
write(params: VectorIndexWriteParams, options?: RPCOptions):
|
|
103
|
+
write(params: VectorIndexWriteParams, options?: RPCOptions): VectorIndexOperation<{
|
|
71
104
|
path: string;
|
|
72
105
|
}>;
|
|
73
106
|
/** Releases worker memory. Safe to call more than once. */
|
|
74
|
-
dispose(options?: RPCOptions):
|
|
107
|
+
dispose(options?: RPCOptions): VectorIndexOperation<void>;
|
|
75
108
|
[Symbol.asyncDispose](): Promise<void>;
|
|
76
109
|
}
|
|
77
110
|
/**
|
|
78
111
|
* Builds the two public functions over a transport. The default export pair
|
|
79
|
-
* below binds them to the RPC client;
|
|
112
|
+
* below binds them to the RPC client; a session binds them to its own
|
|
113
|
+
* stamped transport, and tests bind a fake.
|
|
80
114
|
*/
|
|
81
115
|
export declare function createVectorIndexClient(transport: typeof send): {
|
|
82
|
-
createVectorIndex(params: CreateVectorIndexParams, options?: RPCOptions):
|
|
83
|
-
loadVectorIndex(params: LoadVectorIndexParams, options?: RPCOptions):
|
|
116
|
+
createVectorIndex(params: CreateVectorIndexParams, options?: RPCOptions): VectorIndexOperation<VectorIndex>;
|
|
117
|
+
loadVectorIndex(params: LoadVectorIndexParams, options?: RPCOptions): VectorIndexOperation<VectorIndex>;
|
|
84
118
|
};
|
|
85
119
|
/**
|
|
86
120
|
* Creates an empty vector index in worker memory and returns a handle to it.
|
|
@@ -93,10 +127,10 @@ export declare function createVectorIndexClient(transport: typeof send): {
|
|
|
93
127
|
* documents.
|
|
94
128
|
*
|
|
95
129
|
* @param params - Index parameters
|
|
96
|
-
* @param params.dim - Vector dimensionality, for example 1024 for GTE Large. TurboVec storage needs a multiple of 8 no greater than
|
|
130
|
+
* @param params.dim - Vector dimensionality, for example 1024 for GTE Large. TurboVec storage needs a multiple of 8 no greater than 16384.
|
|
97
131
|
* @param params.storage - Storage mode from `VectorIndexStorage`; defaults to `TURBOVEC_Q4`. `TURBOVEC_Q2` halves memory again at lower recall; `F32`, `Q8`, and `Q4` are exact or generically quantised stores for dimensions TurboVec cannot hold.
|
|
98
132
|
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
99
|
-
* @returns A handle whose methods add, search, remove, snapshot, and dispose the index.
|
|
133
|
+
* @returns A handle whose methods add, search, remove, snapshot, and dispose the index. The pending promise carries `requestId` for `cancel({ requestId })`.
|
|
100
134
|
* @throws {VectorIndexProviderUnavailableError} When no registered plugin exposes a vector index provider
|
|
101
135
|
* @throws {VectorIndexFailedError} When the native index rejects the dimension or storage mode
|
|
102
136
|
*
|
|
@@ -106,7 +140,7 @@ export declare function createVectorIndexClient(transport: typeof send): {
|
|
|
106
140
|
* ['1', 'Saturn moon Titan has lakes of liquid methane.'],
|
|
107
141
|
* ['2', 'Solar panels turn sunlight into electricity.']
|
|
108
142
|
* ])
|
|
109
|
-
* const { embedding } = await
|
|
143
|
+
* const { embedding } = await embedBatch({ modelId, inputs: [...documents.values()] })
|
|
110
144
|
*
|
|
111
145
|
* await using index = await createVectorIndex({ dim: embedding[0].length })
|
|
112
146
|
* await index.add({ ids: [...documents.keys()], vectors: embedding })
|
|
@@ -116,7 +150,7 @@ export declare function createVectorIndexClient(transport: typeof send): {
|
|
|
116
150
|
* console.log(documents.get(hits[0].id))
|
|
117
151
|
* ```
|
|
118
152
|
*/
|
|
119
|
-
export declare function createVectorIndex(params: CreateVectorIndexParams, options?: RPCOptions):
|
|
153
|
+
export declare function createVectorIndex(params: CreateVectorIndexParams, options?: RPCOptions): VectorIndexOperation<VectorIndex>;
|
|
120
154
|
/**
|
|
121
155
|
* Loads a vector index snapshot written by `VectorIndex.write()` into worker
|
|
122
156
|
* memory and returns a handle to it.
|
|
@@ -139,5 +173,5 @@ export declare function createVectorIndex(params: CreateVectorIndexParams, optio
|
|
|
139
173
|
* await index.dispose()
|
|
140
174
|
* ```
|
|
141
175
|
*/
|
|
142
|
-
export declare function loadVectorIndex(params: LoadVectorIndexParams, options?: RPCOptions):
|
|
176
|
+
export declare function loadVectorIndex(params: LoadVectorIndexParams, options?: RPCOptions): VectorIndexOperation<VectorIndex>;
|
|
143
177
|
//# sourceMappingURL=vector-index.d.ts.map
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import { send } from '
|
|
1
|
+
import { send } from '../../client/rpc/rpc-client.js';
|
|
2
2
|
import { DEFAULT_VECTOR_INDEX_STORAGE, findVectorRowLengthMismatch, toWireVectorIds } from '@qvac/inference/surface';
|
|
3
3
|
import { InvalidOperationError, InvalidResponseError, RequestValidationFailedError } from '../../utils/errors-client.js';
|
|
4
|
+
import { decoratePromise } from '../../utils/decorate-promise.js';
|
|
5
|
+
import { generateClientRequestId } from '../../client/api/client-request-id.js';
|
|
4
6
|
/**
|
|
5
7
|
* Builds the two public functions over a transport. The default export pair
|
|
6
|
-
* below binds them to the RPC client;
|
|
8
|
+
* below binds them to the RPC client; a session binds them to its own
|
|
9
|
+
* stamped transport, and tests bind a fake.
|
|
7
10
|
*/
|
|
8
11
|
export function createVectorIndexClient(transport) {
|
|
9
|
-
|
|
10
|
-
|
|
12
|
+
// Every operation is sent under a client-minted id, so a pending one can be
|
|
13
|
+
// cancelled by id before it settles.
|
|
14
|
+
async function call(request, requestId, options) {
|
|
15
|
+
const response = await transport({ ...request, requestId }, options);
|
|
11
16
|
if (response.type !== 'vectorIndex') {
|
|
12
17
|
throw new InvalidResponseError('vectorIndex');
|
|
13
18
|
}
|
|
@@ -16,9 +21,15 @@ export function createVectorIndexClient(transport) {
|
|
|
16
21
|
}
|
|
17
22
|
return response;
|
|
18
23
|
}
|
|
24
|
+
function operation(run) {
|
|
25
|
+
const requestId = generateClientRequestId();
|
|
26
|
+
return decoratePromise(run(requestId), { requestId });
|
|
27
|
+
}
|
|
19
28
|
function createHandle(opened) {
|
|
20
29
|
const { indexId, dim, storage } = opened;
|
|
21
30
|
let length = opened.length;
|
|
31
|
+
let calibrated = opened.calibrated;
|
|
32
|
+
let stagedSearch = opened.stagedSearch;
|
|
22
33
|
let disposed = false;
|
|
23
34
|
// Row lengths are checked here so a mismatch fails before any request is
|
|
24
35
|
// sent and before the worker touches native memory.
|
|
@@ -30,17 +41,21 @@ export function createVectorIndexClient(transport) {
|
|
|
30
41
|
}
|
|
31
42
|
// The flag is set only after the worker confirms, so a failed dispose
|
|
32
43
|
// can be retried instead of leaking the index until worker shutdown.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
function dispose(options) {
|
|
45
|
+
return operation(async (requestId) => {
|
|
46
|
+
if (disposed)
|
|
47
|
+
return;
|
|
48
|
+
await call({ type: 'vectorIndex', operation: 'dispose', indexId }, requestId, options);
|
|
49
|
+
disposed = true;
|
|
50
|
+
});
|
|
38
51
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
function search(params, options) {
|
|
53
|
+
return operation(async (requestId) => {
|
|
54
|
+
const queries = 'queries' in params ? params.queries : [params.query];
|
|
55
|
+
assertRows(queries, 'queries');
|
|
56
|
+
const response = await call({ type: 'vectorIndex', operation: 'search', indexId, queries, k: params.k }, requestId, options);
|
|
57
|
+
return 'queries' in params ? response.results : (response.results[0] ?? []);
|
|
58
|
+
});
|
|
44
59
|
}
|
|
45
60
|
const handle = {
|
|
46
61
|
indexId,
|
|
@@ -49,31 +64,64 @@ export function createVectorIndexClient(transport) {
|
|
|
49
64
|
get length() {
|
|
50
65
|
return length;
|
|
51
66
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
get calibrated() {
|
|
68
|
+
return calibrated;
|
|
69
|
+
},
|
|
70
|
+
get stagedSearch() {
|
|
71
|
+
return stagedSearch;
|
|
72
|
+
},
|
|
73
|
+
setStagedSearch(params, options) {
|
|
74
|
+
return operation(async (requestId) => {
|
|
75
|
+
const response = await call({
|
|
76
|
+
type: 'vectorIndex',
|
|
77
|
+
operation: 'setStagedSearch',
|
|
78
|
+
indexId,
|
|
79
|
+
enabled: params.enabled
|
|
80
|
+
}, requestId, options);
|
|
81
|
+
stagedSearch = response.stagedSearch;
|
|
82
|
+
return { stagedSearch };
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
add(params, options) {
|
|
86
|
+
return operation(async (requestId) => {
|
|
87
|
+
assertRows(params.vectors, 'vectors');
|
|
88
|
+
const response = await call({
|
|
89
|
+
type: 'vectorIndex',
|
|
90
|
+
operation: 'add',
|
|
91
|
+
indexId,
|
|
92
|
+
ids: toWireVectorIds(params.ids),
|
|
93
|
+
vectors: params.vectors
|
|
94
|
+
}, requestId, options);
|
|
95
|
+
length = response.length;
|
|
96
|
+
calibrated = response.calibrated;
|
|
97
|
+
stagedSearch = response.stagedSearch;
|
|
98
|
+
return { length };
|
|
99
|
+
});
|
|
63
100
|
},
|
|
64
101
|
search,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
102
|
+
remove(params, options) {
|
|
103
|
+
return operation(async (requestId) => {
|
|
104
|
+
const response = await call({ type: 'vectorIndex', operation: 'remove', indexId, ids: toWireVectorIds(params.ids) }, requestId, options);
|
|
105
|
+
length = response.length;
|
|
106
|
+
return response.removed;
|
|
107
|
+
});
|
|
69
108
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
109
|
+
contains(params, options) {
|
|
110
|
+
return operation(async (requestId) => {
|
|
111
|
+
const response = await call({
|
|
112
|
+
type: 'vectorIndex',
|
|
113
|
+
operation: 'contains',
|
|
114
|
+
indexId,
|
|
115
|
+
ids: toWireVectorIds(params.ids)
|
|
116
|
+
}, requestId, options);
|
|
117
|
+
return response.present;
|
|
118
|
+
});
|
|
73
119
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
120
|
+
write(params, options) {
|
|
121
|
+
return operation(async (requestId) => {
|
|
122
|
+
const response = await call({ type: 'vectorIndex', operation: 'write', indexId, path: params.path }, requestId, options);
|
|
123
|
+
return { path: response.path };
|
|
124
|
+
});
|
|
77
125
|
},
|
|
78
126
|
dispose
|
|
79
127
|
};
|
|
@@ -88,18 +136,22 @@ export function createVectorIndexClient(transport) {
|
|
|
88
136
|
return handle;
|
|
89
137
|
}
|
|
90
138
|
return {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
139
|
+
createVectorIndex(params, options) {
|
|
140
|
+
return operation(async (requestId) => {
|
|
141
|
+
const response = await call({
|
|
142
|
+
type: 'vectorIndex',
|
|
143
|
+
operation: 'create',
|
|
144
|
+
dim: params.dim,
|
|
145
|
+
storage: params.storage ?? DEFAULT_VECTOR_INDEX_STORAGE
|
|
146
|
+
}, requestId, options);
|
|
147
|
+
return createHandle(response);
|
|
148
|
+
});
|
|
99
149
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
loadVectorIndex(params, options) {
|
|
151
|
+
return operation(async (requestId) => {
|
|
152
|
+
const response = await call({ type: 'vectorIndex', operation: 'load', path: params.path }, requestId, options);
|
|
153
|
+
return createHandle(response);
|
|
154
|
+
});
|
|
103
155
|
}
|
|
104
156
|
};
|
|
105
157
|
}
|
|
@@ -115,10 +167,10 @@ const client = createVectorIndexClient(send);
|
|
|
115
167
|
* documents.
|
|
116
168
|
*
|
|
117
169
|
* @param params - Index parameters
|
|
118
|
-
* @param params.dim - Vector dimensionality, for example 1024 for GTE Large. TurboVec storage needs a multiple of 8 no greater than
|
|
170
|
+
* @param params.dim - Vector dimensionality, for example 1024 for GTE Large. TurboVec storage needs a multiple of 8 no greater than 16384.
|
|
119
171
|
* @param params.storage - Storage mode from `VectorIndexStorage`; defaults to `TURBOVEC_Q4`. `TURBOVEC_Q2` halves memory again at lower recall; `F32`, `Q8`, and `Q4` are exact or generically quantised stores for dimensions TurboVec cannot hold.
|
|
120
172
|
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
121
|
-
* @returns A handle whose methods add, search, remove, snapshot, and dispose the index.
|
|
173
|
+
* @returns A handle whose methods add, search, remove, snapshot, and dispose the index. The pending promise carries `requestId` for `cancel({ requestId })`.
|
|
122
174
|
* @throws {VectorIndexProviderUnavailableError} When no registered plugin exposes a vector index provider
|
|
123
175
|
* @throws {VectorIndexFailedError} When the native index rejects the dimension or storage mode
|
|
124
176
|
*
|
|
@@ -128,7 +180,7 @@ const client = createVectorIndexClient(send);
|
|
|
128
180
|
* ['1', 'Saturn moon Titan has lakes of liquid methane.'],
|
|
129
181
|
* ['2', 'Solar panels turn sunlight into electricity.']
|
|
130
182
|
* ])
|
|
131
|
-
* const { embedding } = await
|
|
183
|
+
* const { embedding } = await embedBatch({ modelId, inputs: [...documents.values()] })
|
|
132
184
|
*
|
|
133
185
|
* await using index = await createVectorIndex({ dim: embedding[0].length })
|
|
134
186
|
* await index.add({ ids: [...documents.keys()], vectors: embedding })
|
|
@@ -16,6 +16,7 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
16
16
|
cfg_scale?: number | undefined;
|
|
17
17
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
18
18
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
19
|
+
vae_tile_size?: string | number | undefined;
|
|
19
20
|
cache_preset?: string | undefined;
|
|
20
21
|
stg_scale?: number | undefined;
|
|
21
22
|
stg_block?: number | undefined;
|
|
@@ -29,7 +30,6 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
29
30
|
high_noise_flow_shift?: number | undefined;
|
|
30
31
|
moe_boundary?: number | undefined;
|
|
31
32
|
vace_strength?: number | undefined;
|
|
32
|
-
vae_tile_size?: string | number | undefined;
|
|
33
33
|
vae_tile_overlap?: number | undefined;
|
|
34
34
|
temporal_tiling?: boolean | undefined;
|
|
35
35
|
cache_mode?: "disabled" | "easycache" | "ucache" | "dbcache" | "taylorseer" | "cache-dit" | undefined;
|
|
@@ -57,6 +57,7 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
57
57
|
cfg_scale?: number | undefined;
|
|
58
58
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
59
59
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
60
|
+
vae_tile_size?: string | number | undefined;
|
|
60
61
|
cache_preset?: string | undefined;
|
|
61
62
|
stg_scale?: number | undefined;
|
|
62
63
|
stg_block?: number | undefined;
|
|
@@ -70,7 +71,6 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
70
71
|
high_noise_flow_shift?: number | undefined;
|
|
71
72
|
moe_boundary?: number | undefined;
|
|
72
73
|
vace_strength?: number | undefined;
|
|
73
|
-
vae_tile_size?: string | number | undefined;
|
|
74
74
|
vae_tile_overlap?: number | undefined;
|
|
75
75
|
temporal_tiling?: boolean | undefined;
|
|
76
76
|
cache_mode?: "disabled" | "easycache" | "ucache" | "dbcache" | "taylorseer" | "cache-dit" | undefined;
|
|
@@ -98,6 +98,7 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
98
98
|
cfg_scale?: number | undefined;
|
|
99
99
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
100
100
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
101
|
+
vae_tile_size?: string | number | undefined;
|
|
101
102
|
cache_preset?: string | undefined;
|
|
102
103
|
stg_scale?: number | undefined;
|
|
103
104
|
stg_block?: number | undefined;
|
|
@@ -111,7 +112,6 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
111
112
|
high_noise_flow_shift?: number | undefined;
|
|
112
113
|
moe_boundary?: number | undefined;
|
|
113
114
|
vace_strength?: number | undefined;
|
|
114
|
-
vae_tile_size?: string | number | undefined;
|
|
115
115
|
vae_tile_overlap?: number | undefined;
|
|
116
116
|
temporal_tiling?: boolean | undefined;
|
|
117
117
|
cache_mode?: "disabled" | "easycache" | "ucache" | "dbcache" | "taylorseer" | "cache-dit" | undefined;
|
|
@@ -139,6 +139,7 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
139
139
|
cfg_scale?: number | undefined;
|
|
140
140
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
141
141
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
142
|
+
vae_tile_size?: string | number | undefined;
|
|
142
143
|
cache_preset?: string | undefined;
|
|
143
144
|
stg_scale?: number | undefined;
|
|
144
145
|
stg_block?: number | undefined;
|
|
@@ -152,7 +153,6 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
152
153
|
high_noise_flow_shift?: number | undefined;
|
|
153
154
|
moe_boundary?: number | undefined;
|
|
154
155
|
vace_strength?: number | undefined;
|
|
155
|
-
vae_tile_size?: string | number | undefined;
|
|
156
156
|
vae_tile_overlap?: number | undefined;
|
|
157
157
|
temporal_tiling?: boolean | undefined;
|
|
158
158
|
cache_mode?: "disabled" | "easycache" | "ucache" | "dbcache" | "taylorseer" | "cache-dit" | undefined;
|
|
@@ -180,6 +180,7 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
180
180
|
cfg_scale?: number | undefined;
|
|
181
181
|
sampling_method?: "euler" | "euler_a" | "heun" | "dpm2" | "dpm++2m" | "dpm++2mv2" | "dpm++2s_a" | "lcm" | "ipndm" | "ipndm_v" | "ddim_trailing" | "tcd" | "res_multistep" | "res_2s" | undefined;
|
|
182
182
|
scheduler?: "lcm" | "discrete" | "karras" | "exponential" | "ays" | "gits" | "sgm_uniform" | "simple" | "smoothstep" | "kl_optimal" | "bong_tangent" | "ltx2" | undefined;
|
|
183
|
+
vae_tile_size?: string | number | undefined;
|
|
183
184
|
cache_preset?: string | undefined;
|
|
184
185
|
stg_scale?: number | undefined;
|
|
185
186
|
stg_block?: number | undefined;
|
|
@@ -193,7 +194,6 @@ export declare function createVideoStreamRequest(params: VideoClientParams, requ
|
|
|
193
194
|
high_noise_flow_shift?: number | undefined;
|
|
194
195
|
moe_boundary?: number | undefined;
|
|
195
196
|
vace_strength?: number | undefined;
|
|
196
|
-
vae_tile_size?: string | number | undefined;
|
|
197
197
|
vae_tile_overlap?: number | undefined;
|
|
198
198
|
temporal_tiling?: boolean | undefined;
|
|
199
199
|
cache_mode?: "disabled" | "easycache" | "ucache" | "dbcache" | "taylorseer" | "cache-dit" | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type VideoClientParams, type VideoStats } from '@qvac/inference/surface';
|
|
1
|
+
import { type VideoClientParams, type VideoStats, type RPCOptions } from '@qvac/inference/surface';
|
|
2
2
|
export interface VideoProgressTick {
|
|
3
3
|
step: number;
|
|
4
4
|
totalSteps: number;
|
|
@@ -14,6 +14,7 @@ export interface VideoResult {
|
|
|
14
14
|
* Generates a video using a loaded video diffusion model.
|
|
15
15
|
*
|
|
16
16
|
* @param params - Video request parameters (model, prompt, dimensions, frame count, fps, sampler, seed, etc.).
|
|
17
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection).
|
|
17
18
|
* @returns A result object exposing `requestId` (stable identifier for this in-flight generation), `progressStream` (async iterator of `{ step, totalSteps, elapsedMs }`), `outputs` (promise of the generated video buffers, typically a single AVI file), and `stats` (promise of generation statistics).
|
|
18
19
|
*
|
|
19
20
|
* Supports `txt2vid` (text-to-video) and `img2vid` (image-to-video) for Wan,
|
|
@@ -123,5 +124,5 @@ export interface VideoResult {
|
|
|
123
124
|
* await cancel(requestId);
|
|
124
125
|
* ```
|
|
125
126
|
*/
|
|
126
|
-
export declare function video(params: VideoClientParams): VideoResult;
|
|
127
|
+
export declare function video(params: VideoClientParams, options?: RPCOptions): VideoResult;
|
|
127
128
|
//# sourceMappingURL=video.d.ts.map
|