@qvac/inference 0.19.0 → 0.20.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 +95 -39
- package/dist/api/audio-gen.d.ts +42 -1
- package/dist/api/audio-gen.js +137 -51
- package/dist/api/delete-cache.d.ts +7 -1
- package/dist/api/delete-cache.js +11 -1
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +2 -1
- package/dist/api/text-to-speech.d.ts +31 -4
- package/dist/api/text-to-speech.js +117 -21
- package/dist/api/vector-index.d.ts +142 -0
- package/dist/api/vector-index.js +168 -0
- package/dist/api/world.d.ts +2 -2
- package/dist/errors/index.d.ts +12 -0
- package/dist/errors/index.js +21 -0
- package/dist/handlers/delete-cache.js +3 -0
- package/dist/handlers/vector-index.d.ts +2 -0
- package/dist/handlers/vector-index.js +40 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/models/registry/models.d.ts +351 -12
- package/dist/models/registry/models.js +2271 -1957
- package/dist/models/registry/resource-profiles.js +135 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.d.ts +2 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-edit-stream.js +65 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.d.ts +9 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-input.js +24 -7
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.d.ts +46 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-run.js +218 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.d.ts +1 -1
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-gen-stream.js +56 -225
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.d.ts +8 -0
- package/dist/plugins/builtin/audiogen-ggml/ops/audio-understand.js +28 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.d.ts +248 -0
- package/dist/plugins/builtin/audiogen-ggml/plugin.js +17 -1
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.d.ts +5 -2
- package/dist/plugins/builtin/bci-whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/ggml-ocr/plugin.d.ts +1 -1
- package/dist/plugins/builtin/ggml-ocr/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/batch-completion-stream.js +6 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-completion/ops/cache-logger.js +0 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.d.ts +2 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stats.js +6 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js +96 -89
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.d.ts +0 -1
- package/dist/plugins/builtin/llamacpp-completion/ops/context-overflow.js +0 -31
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.d.ts +48 -27
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-session.js +239 -135
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.d.ts +11 -4
- package/dist/plugins/builtin/llamacpp-completion/ops/kv-cache-state.js +18 -16
- package/dist/plugins/builtin/llamacpp-completion/plugin.d.ts +11 -4
- package/dist/plugins/builtin/llamacpp-completion/plugin.js +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.d.ts +1 -2
- package/dist/plugins/builtin/llamacpp-embedding/plugin.js +2 -38
- package/dist/plugins/builtin/llamacpp-embedding/transform.d.ts +9 -0
- package/dist/plugins/builtin/llamacpp-embedding/transform.js +42 -0
- package/dist/plugins/builtin/nmtcpp-translation/plugin.d.ts +1 -1
- package/dist/plugins/builtin/nmtcpp-translation/plugin.js +1 -2
- package/dist/plugins/builtin/parakeet-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/parakeet-transcription/plugin.js +1 -2
- package/dist/plugins/builtin/sdcpp-generation/ops/video.d.ts +1 -0
- package/dist/plugins/builtin/sdcpp-generation/ops/video.js +8 -2
- package/dist/plugins/builtin/sdcpp-generation/plugin.d.ts +9 -4
- package/dist/plugins/builtin/sdcpp-generation/plugin.js +51 -19
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.d.ts +29 -0
- package/dist/plugins/builtin/tts-ggml/ops/cancel-binding.js +66 -0
- package/dist/plugins/builtin/tts-ggml/ops/parler-options.js +10 -0
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.d.ts +3 -5
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech-stream.js +143 -28
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.d.ts +5 -2
- package/dist/plugins/builtin/tts-ggml/ops/text-to-speech.js +182 -66
- package/dist/plugins/builtin/tts-ggml/plugin.d.ts +267 -22
- package/dist/plugins/builtin/tts-ggml/plugin.js +94 -35
- package/dist/plugins/builtin/whispercpp-transcription/plugin.d.ts +1 -1
- package/dist/plugins/builtin/whispercpp-transcription/plugin.js +1 -2
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/ops/load-model.js +22 -2
- package/dist/plugins/ops/translate.js +58 -12
- package/dist/plugins/ops/translatepsy-utils.d.ts +17 -0
- package/dist/plugins/ops/translatepsy-utils.js +32 -0
- package/dist/plugins/registry.d.ts +15 -0
- package/dist/plugins/registry.js +133 -15
- package/dist/plugins/turbovec-backend.d.ts +17 -0
- package/dist/plugins/turbovec-backend.js +99 -0
- package/dist/registry.js +4 -0
- package/dist/resources/model-fit/assess.js +169 -68
- package/dist/resources/model-fit/estimators/llm.d.ts +1 -0
- package/dist/resources/model-fit/estimators/llm.js +3 -1
- package/dist/resources/model-fit/floor.d.ts +31 -0
- package/dist/resources/model-fit/floor.js +65 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.d.ts +46 -0
- package/dist/resources/model-fit/native-probe/advisory-fit.js +214 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.d.ts +26 -0
- package/dist/resources/model-fit/native-probe/create-llama-fit-request.js +171 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.d.ts +42 -0
- package/dist/resources/model-fit/native-probe/run-in-process-fit.js +192 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.d.ts +70 -0
- package/dist/resources/model-fit/native-probe/run-isolated-fit.js +372 -0
- package/dist/resources/native.js +5 -4
- package/dist/resources/types.d.ts +1 -3
- package/dist/runtime/env.d.ts +2 -0
- package/dist/runtime/env.js +9 -2
- package/dist/runtime/lifecycle.js +2 -0
- package/dist/runtime/model-registry.d.ts +3 -1
- package/dist/runtime/model-registry.js +2 -1
- package/dist/runtime/request-context.js +17 -0
- package/dist/runtime/vector-index-backend.d.ts +25 -0
- package/dist/runtime/vector-index-backend.js +1 -0
- package/dist/runtime/vector-index-registry.d.ts +76 -0
- package/dist/runtime/vector-index-registry.js +161 -0
- package/dist/schemas/assess-model-fit.d.ts +84 -0
- package/dist/schemas/assess-model-fit.js +72 -3
- package/dist/schemas/audio-gen.d.ts +482 -7
- package/dist/schemas/audio-gen.js +376 -17
- package/dist/schemas/batch-completion-stream.d.ts +10 -0
- package/dist/schemas/batch-completion-stream.js +5 -3
- package/dist/schemas/bci.d.ts +1 -1
- package/dist/schemas/common.d.ts +782 -19
- package/dist/schemas/common.js +8 -1
- package/dist/schemas/completion-event.d.ts +14 -1
- package/dist/schemas/completion-event.js +4 -0
- package/dist/schemas/completion-stream.d.ts +22 -0
- package/dist/schemas/completion-stream.js +41 -4
- package/dist/schemas/config.d.ts +48 -30
- package/dist/schemas/errors.d.ts +4 -0
- package/dist/schemas/errors.js +22 -0
- package/dist/schemas/index.d.ts +1 -0
- package/dist/schemas/index.js +1 -0
- package/dist/schemas/llamacpp-config.d.ts +4 -8
- package/dist/schemas/llamacpp-config.js +4 -4
- package/dist/schemas/load-model.d.ts +2604 -180
- package/dist/schemas/model-config-schemas.d.ts +228 -5
- package/dist/schemas/model-ops.d.ts +3 -0
- package/dist/schemas/model-ops.js +6 -0
- package/dist/schemas/plugin.d.ts +21 -11
- package/dist/schemas/sdcpp-config.d.ts +221 -4
- package/dist/schemas/sdcpp-config.js +128 -22
- package/dist/schemas/text-to-speech.d.ts +780 -19
- package/dist/schemas/text-to-speech.js +298 -44
- package/dist/schemas/transcription-config.js +7 -4
- package/dist/schemas/vector-index.d.ts +194 -0
- package/dist/schemas/vector-index.js +185 -0
- package/dist/utils/addon-responses.d.ts +30 -3
- package/dist/utils/aggregate-events.d.ts +3 -1
- package/dist/utils/aggregate-events.js +7 -1
- package/dist/utils/tts-stats.d.ts +15 -11
- package/dist/utils/tts-stats.js +33 -11
- package/package.json +29 -26
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { send } from '../dispatch.js';
|
|
2
|
+
import { DEFAULT_VECTOR_INDEX_STORAGE, findVectorRowLengthMismatch, toWireVectorIds } from '../schemas/index.js';
|
|
3
|
+
import { InvalidOperationError, InvalidResponseError, RequestValidationFailedError } from '../errors/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* Builds the two public functions over a transport. The default export pair
|
|
6
|
+
* below binds them to the engine dispatcher; tests bind a fake instead.
|
|
7
|
+
*/
|
|
8
|
+
export function createVectorIndexClient(transport) {
|
|
9
|
+
async function call(request, options) {
|
|
10
|
+
const response = await transport(request, options);
|
|
11
|
+
if (response.type !== 'vectorIndex') {
|
|
12
|
+
throw new InvalidResponseError('vectorIndex');
|
|
13
|
+
}
|
|
14
|
+
if (response.operation !== request.operation) {
|
|
15
|
+
throw new InvalidOperationError();
|
|
16
|
+
}
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
19
|
+
function createHandle(opened) {
|
|
20
|
+
const { indexId, dim, storage } = opened;
|
|
21
|
+
let length = opened.length;
|
|
22
|
+
let disposed = false;
|
|
23
|
+
// Row lengths are checked here so a mismatch fails before any request is
|
|
24
|
+
// sent and before the worker touches native memory.
|
|
25
|
+
function assertRows(rows, label) {
|
|
26
|
+
const mismatch = findVectorRowLengthMismatch(rows, dim);
|
|
27
|
+
if (mismatch === -1)
|
|
28
|
+
return;
|
|
29
|
+
throw new RequestValidationFailedError(`${label}[${mismatch}] has ${rows[mismatch]?.length ?? 0} components, expected ${dim}`);
|
|
30
|
+
}
|
|
31
|
+
// The flag is set only after the worker confirms, so a failed dispose
|
|
32
|
+
// can be retried instead of leaking the index until worker shutdown.
|
|
33
|
+
async function dispose(options) {
|
|
34
|
+
if (disposed)
|
|
35
|
+
return;
|
|
36
|
+
await call({ type: 'vectorIndex', operation: 'dispose', indexId }, options);
|
|
37
|
+
disposed = true;
|
|
38
|
+
}
|
|
39
|
+
async function search(params, options) {
|
|
40
|
+
const queries = 'queries' in params ? params.queries : [params.query];
|
|
41
|
+
assertRows(queries, 'queries');
|
|
42
|
+
const response = await call({ type: 'vectorIndex', operation: 'search', indexId, queries, k: params.k }, options);
|
|
43
|
+
return 'queries' in params ? response.results : (response.results[0] ?? []);
|
|
44
|
+
}
|
|
45
|
+
const handle = {
|
|
46
|
+
indexId,
|
|
47
|
+
dim,
|
|
48
|
+
storage,
|
|
49
|
+
get length() {
|
|
50
|
+
return length;
|
|
51
|
+
},
|
|
52
|
+
async add(params, options) {
|
|
53
|
+
assertRows(params.vectors, 'vectors');
|
|
54
|
+
const response = await call({
|
|
55
|
+
type: 'vectorIndex',
|
|
56
|
+
operation: 'add',
|
|
57
|
+
indexId,
|
|
58
|
+
ids: toWireVectorIds(params.ids),
|
|
59
|
+
vectors: params.vectors
|
|
60
|
+
}, options);
|
|
61
|
+
length = response.length;
|
|
62
|
+
return { length };
|
|
63
|
+
},
|
|
64
|
+
search,
|
|
65
|
+
async remove(params, options) {
|
|
66
|
+
const response = await call({ type: 'vectorIndex', operation: 'remove', indexId, ids: toWireVectorIds(params.ids) }, options);
|
|
67
|
+
length = response.length;
|
|
68
|
+
return response.removed;
|
|
69
|
+
},
|
|
70
|
+
async contains(params, options) {
|
|
71
|
+
const response = await call({ type: 'vectorIndex', operation: 'contains', indexId, ids: toWireVectorIds(params.ids) }, options);
|
|
72
|
+
return response.present;
|
|
73
|
+
},
|
|
74
|
+
async write(params, options) {
|
|
75
|
+
const response = await call({ type: 'vectorIndex', operation: 'write', indexId, path: params.path }, options);
|
|
76
|
+
return { path: response.path };
|
|
77
|
+
},
|
|
78
|
+
dispose
|
|
79
|
+
};
|
|
80
|
+
// Older runtimes without explicit resource management have no symbol to
|
|
81
|
+
// key the method on; `dispose()` remains available there.
|
|
82
|
+
if (typeof Symbol.asyncDispose === 'symbol') {
|
|
83
|
+
Object.defineProperty(handle, Symbol.asyncDispose, {
|
|
84
|
+
value: () => dispose(),
|
|
85
|
+
enumerable: false
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return handle;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
async createVectorIndex(params, options) {
|
|
92
|
+
const response = await call({
|
|
93
|
+
type: 'vectorIndex',
|
|
94
|
+
operation: 'create',
|
|
95
|
+
dim: params.dim,
|
|
96
|
+
storage: params.storage ?? DEFAULT_VECTOR_INDEX_STORAGE
|
|
97
|
+
}, options);
|
|
98
|
+
return createHandle(response);
|
|
99
|
+
},
|
|
100
|
+
async loadVectorIndex(params, options) {
|
|
101
|
+
const response = await call({ type: 'vectorIndex', operation: 'load', path: params.path }, options);
|
|
102
|
+
return createHandle(response);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const client = createVectorIndexClient(send);
|
|
107
|
+
/**
|
|
108
|
+
* Creates an empty vector index in worker memory and returns a handle to it.
|
|
109
|
+
*
|
|
110
|
+
* The index is backed by the native TurboVec engine of the registered
|
|
111
|
+
* embedding plugin (the built-in llama.cpp embedding plugin provides it).
|
|
112
|
+
* Pair it with `embed()` to build retrieval over documents kept in any store:
|
|
113
|
+
* add each document's embedding under an id of your choosing, then search
|
|
114
|
+
* with the embedding of a query and map the returned ids back to your
|
|
115
|
+
* documents.
|
|
116
|
+
*
|
|
117
|
+
* @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 1024.
|
|
119
|
+
* @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
|
+
* @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.
|
|
122
|
+
* @throws {VectorIndexProviderUnavailableError} When no registered plugin exposes a vector index provider
|
|
123
|
+
* @throws {VectorIndexFailedError} When the native index rejects the dimension or storage mode
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const documents = new Map([
|
|
128
|
+
* ['1', 'Saturn moon Titan has lakes of liquid methane.'],
|
|
129
|
+
* ['2', 'Solar panels turn sunlight into electricity.']
|
|
130
|
+
* ])
|
|
131
|
+
* const { embedding } = await embed({ modelId, text: [...documents.values()] })
|
|
132
|
+
*
|
|
133
|
+
* await using index = await createVectorIndex({ dim: embedding[0].length })
|
|
134
|
+
* await index.add({ ids: [...documents.keys()], vectors: embedding })
|
|
135
|
+
*
|
|
136
|
+
* const { embedding: query } = await embed({ modelId, text: 'Which moon has methane lakes?' })
|
|
137
|
+
* const hits = await index.search({ query, k: 1 })
|
|
138
|
+
* console.log(documents.get(hits[0].id))
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
export function createVectorIndex(params, options) {
|
|
142
|
+
return client.createVectorIndex(params, options);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Loads a vector index snapshot written by `VectorIndex.write()` into worker
|
|
146
|
+
* memory and returns a handle to it.
|
|
147
|
+
*
|
|
148
|
+
* The snapshot records its dimension, storage mode, and entries, so nothing
|
|
149
|
+
* else needs to be supplied. Loading copies the file into memory; later
|
|
150
|
+
* changes are not written back until `write()` is called again.
|
|
151
|
+
*
|
|
152
|
+
* @param params - Load parameters
|
|
153
|
+
* @param params.path - Snapshot path. An absolute path is used as given; a relative path resolves under the QVAC data directory, the same rule `write()` applies.
|
|
154
|
+
* @param options - Optional RPC options (timeout, profiling, force new connection, etc.).
|
|
155
|
+
* @returns A handle to the loaded index.
|
|
156
|
+
* @throws {VectorIndexProviderUnavailableError} When no registered plugin exposes a vector index provider
|
|
157
|
+
* @throws {VectorIndexFailedError} When the file is missing, corrupt, or not a vector index snapshot
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* const index = await loadVectorIndex({ path: 'indexes/articles.qvi' })
|
|
162
|
+
* const hits = await index.search({ query, k: 5 })
|
|
163
|
+
* await index.dispose()
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export function loadVectorIndex(params, options) {
|
|
167
|
+
return client.loadVectorIndex(params, options);
|
|
168
|
+
}
|
package/dist/api/world.d.ts
CHANGED
|
@@ -45,9 +45,9 @@ import { type WorldSceneResult, type WorldSceneResultWithPack, type WorldStepRes
|
|
|
45
45
|
* modelSrc: ABOT_WORLD_0_5B_Q8_0,
|
|
46
46
|
* modelConfig: {
|
|
47
47
|
* mode: "world",
|
|
48
|
-
* taehvModelSrc:
|
|
48
|
+
* taehvModelSrc: ABOT_WORLD_0_5B_LF_TAEHV_VAE,
|
|
49
49
|
* t5XxlModelSrc: UMT5_XXL_ENC_Q8_0,
|
|
50
|
-
* vaeModelSrc:
|
|
50
|
+
* vaeModelSrc: ABOT_WORLD_0_5B_LF_WAN_VAE,
|
|
51
51
|
* world: { seed: 42, kvCache: true },
|
|
52
52
|
* },
|
|
53
53
|
* });
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -293,6 +293,18 @@ export declare class RAGWorkspaceInUseError extends QvacErrorBase {
|
|
|
293
293
|
export declare class RAGWorkspaceNotOpenError extends QvacErrorBase {
|
|
294
294
|
constructor(workspace: string, cause?: unknown);
|
|
295
295
|
}
|
|
296
|
+
export declare class VectorIndexProviderUnavailableError extends QvacErrorBase {
|
|
297
|
+
constructor(cause?: unknown);
|
|
298
|
+
}
|
|
299
|
+
export declare class VectorIndexNotFoundError extends QvacErrorBase {
|
|
300
|
+
constructor(indexId: string, cause?: unknown);
|
|
301
|
+
}
|
|
302
|
+
export declare class VectorIndexInvalidVectorsError extends QvacErrorBase {
|
|
303
|
+
constructor(details: string, cause?: unknown);
|
|
304
|
+
}
|
|
305
|
+
export declare class VectorIndexFailedError extends QvacErrorBase {
|
|
306
|
+
constructor(details: string, cause?: unknown);
|
|
307
|
+
}
|
|
296
308
|
export declare class FileNotFoundError extends QvacErrorBase {
|
|
297
309
|
constructor(path: string, cause?: unknown);
|
|
298
310
|
}
|
package/dist/errors/index.js
CHANGED
|
@@ -472,6 +472,27 @@ export class RAGWorkspaceNotOpenError extends QvacErrorBase {
|
|
|
472
472
|
super(createErrorOptions(ERROR_CODES.RAG_WORKSPACE_NOT_OPEN, [workspace], cause));
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
+
// ============== Vector index ==============
|
|
476
|
+
export class VectorIndexProviderUnavailableError extends QvacErrorBase {
|
|
477
|
+
constructor(cause) {
|
|
478
|
+
super(createErrorOptions(ERROR_CODES.VECTOR_INDEX_PROVIDER_UNAVAILABLE, undefined, cause));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
export class VectorIndexNotFoundError extends QvacErrorBase {
|
|
482
|
+
constructor(indexId, cause) {
|
|
483
|
+
super(createErrorOptions(ERROR_CODES.VECTOR_INDEX_NOT_FOUND, [indexId], cause));
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
export class VectorIndexInvalidVectorsError extends QvacErrorBase {
|
|
487
|
+
constructor(details, cause) {
|
|
488
|
+
super(createErrorOptions(ERROR_CODES.VECTOR_INDEX_INVALID_VECTORS, [details], cause));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
export class VectorIndexFailedError extends QvacErrorBase {
|
|
492
|
+
constructor(details, cause) {
|
|
493
|
+
super(createErrorOptions(ERROR_CODES.VECTOR_INDEX_FAILED, [details], cause));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
475
496
|
// ============== Download / resource ==============
|
|
476
497
|
export class FileNotFoundError extends QvacErrorBase {
|
|
477
498
|
constructor(path, cause) {
|
|
@@ -15,6 +15,9 @@ export async function handleDeleteCache(request) {
|
|
|
15
15
|
if ('all' in request && request.all) {
|
|
16
16
|
await deleteKvCacheState({ all: true });
|
|
17
17
|
}
|
|
18
|
+
else if ('auto' in request && request.auto) {
|
|
19
|
+
await deleteKvCacheState({ auto: true });
|
|
20
|
+
}
|
|
18
21
|
else if ('kvCacheKey' in request) {
|
|
19
22
|
await deleteKvCacheState({
|
|
20
23
|
kvCacheKey: request.kvCacheKey,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { vectorIndexRequestSchema } from '../schemas/index.js';
|
|
2
|
+
import { profileReplyHandler, registerOperationMetrics } from '../profiling/index.js';
|
|
3
|
+
import { addVectors, containsVectors, createVectorIndex, disposeVectorIndex, loadVectorIndex, removeVectors, searchVectors, writeVectorIndex } from '../runtime/vector-index-registry.js';
|
|
4
|
+
registerOperationMetrics({
|
|
5
|
+
op: 'vectorIndex',
|
|
6
|
+
kind: 'handler',
|
|
7
|
+
getTags: (req) => (req.operation ? { operation: req.operation } : {}),
|
|
8
|
+
fromResult: (res) => {
|
|
9
|
+
const gauges = {};
|
|
10
|
+
if (typeof res.length === 'number')
|
|
11
|
+
gauges['length'] = res.length;
|
|
12
|
+
if (res.results !== undefined)
|
|
13
|
+
gauges['queries'] = res.results.length;
|
|
14
|
+
return Object.keys(gauges).length > 0 ? gauges : undefined;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export async function handleVectorIndex(request) {
|
|
18
|
+
return profileReplyHandler({ op: 'vectorIndex', request }, async () => handleVectorIndexInternal(request));
|
|
19
|
+
}
|
|
20
|
+
async function handleVectorIndexInternal(input) {
|
|
21
|
+
const request = vectorIndexRequestSchema.parse(input);
|
|
22
|
+
switch (request.operation) {
|
|
23
|
+
case 'create':
|
|
24
|
+
return { type: 'vectorIndex', operation: 'create', ...createVectorIndex(request) };
|
|
25
|
+
case 'load':
|
|
26
|
+
return { type: 'vectorIndex', operation: 'load', ...loadVectorIndex(request) };
|
|
27
|
+
case 'add':
|
|
28
|
+
return { type: 'vectorIndex', operation: 'add', ...addVectors(request) };
|
|
29
|
+
case 'search':
|
|
30
|
+
return { type: 'vectorIndex', operation: 'search', ...searchVectors(request) };
|
|
31
|
+
case 'remove':
|
|
32
|
+
return { type: 'vectorIndex', operation: 'remove', ...removeVectors(request) };
|
|
33
|
+
case 'contains':
|
|
34
|
+
return { type: 'vectorIndex', operation: 'contains', ...containsVectors(request) };
|
|
35
|
+
case 'write':
|
|
36
|
+
return { type: 'vectorIndex', operation: 'write', ...(await writeVectorIndex(request)) };
|
|
37
|
+
case 'dispose':
|
|
38
|
+
return { type: 'vectorIndex', operation: 'dispose', ...disposeVectorIndex(request) };
|
|
39
|
+
}
|
|
40
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, audioGen, classify, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, type FinetuneHandle } from './api/index.js';
|
|
1
|
+
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, type VectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, type ServerLogHandler, ocr, invokePlugin, invokePluginStream, diffusion, type DiffusionProgressTick, audioGen, audioEdit, audioUnderstand, classify, video, type VideoProgressTick, upscale, worldCreateScene, worldStep, type WorldStepResult, type WorldStepProgressTick, type WorldSceneResult, type WorldSceneResultWithPack, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, type ModelRegistrySearchParams, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE, type FinetuneHandle } from './api/index.js';
|
|
2
2
|
export { close } from './dispatch.js';
|
|
3
3
|
export { plugins, registerPlugin, registerPlugins, getPlugin, hasPlugin, getAllPlugins, unregisterPlugin } from './plugins/index.js';
|
|
4
4
|
export * from './surface.js';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Public API: the operations, engine lifecycle and explicit plugin assembly, and
|
|
3
3
|
// the value-clean surface (schemas / types / consts / errors / model registry)
|
|
4
4
|
// re-exported from `./surface`.
|
|
5
|
-
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, audioGen, classify, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from './api/index.js';
|
|
5
|
+
export { batchCompletion, completion, deleteCache, loadModel, downloadAsset, heartbeat, unloadModel, transcribe, transcribeStream, bciTranscribe, bciTranscribeStream, embed, finetune, translate, cancel, ragChunk, ragIngest, ragSaveEmbeddings, ragSearch, ragDeleteEmbeddings, ragReindex, ragListWorkspaces, ragCloseWorkspace, ragDeleteWorkspace, createVectorIndex, loadVectorIndex, textToSpeech, textToSpeechStream, getModelInfo, getLoadedModelInfo, getSystemResources, assessModelFit, loggingStream, subscribeServerLogs, ocr, invokePlugin, invokePluginStream, diffusion, audioGen, audioEdit, audioUnderstand, classify, video, upscale, worldCreateScene, worldStep, modelRegistryList, modelRegistrySearch, modelRegistryGetModel, suspend, resume, state, vla, vlaHparams, vlaSetEmbodiment, vlaPreprocessImage, vlaPadState, VLA_DEFAULT_IMAGE_SIZE } from './api/index.js';
|
|
6
6
|
// Engine lifecycle and explicit plugin assembly. No plugins are registered by
|
|
7
7
|
// default: an app assembles the engines it needs via `plugins([...])` or the
|
|
8
8
|
// `registerPlugin`/`registerPlugins` primitives, then calls the operations.
|