@qvac/sdk 0.1.0-dev.1760648187.328e967
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 +202 -0
- package/README.md +301 -0
- package/dist/client/api/cancel.d.ts +25 -0
- package/dist/client/api/cancel.js +37 -0
- package/dist/client/api/completion-stream.d.ts +50 -0
- package/dist/client/api/completion-stream.js +103 -0
- package/dist/client/api/download-asset.d.ts +39 -0
- package/dist/client/api/download-asset.js +72 -0
- package/dist/client/api/embed.d.ts +11 -0
- package/dist/client/api/embed.js +24 -0
- package/dist/client/api/index.d.ts +13 -0
- package/dist/client/api/index.js +12 -0
- package/dist/client/api/load-model.d.ts +98 -0
- package/dist/client/api/load-model.js +154 -0
- package/dist/client/api/logging-stream.d.ts +21 -0
- package/dist/client/api/logging-stream.js +32 -0
- package/dist/client/api/ping.d.ts +11 -0
- package/dist/client/api/ping.js +18 -0
- package/dist/client/api/provide.d.ts +18 -0
- package/dist/client/api/provide.js +27 -0
- package/dist/client/api/rag.d.ts +42 -0
- package/dist/client/api/rag.js +97 -0
- package/dist/client/api/transcribe.d.ts +24 -0
- package/dist/client/api/transcribe.js +52 -0
- package/dist/client/api/translate.d.ts +47 -0
- package/dist/client/api/translate.js +114 -0
- package/dist/client/api/unload-model.d.ts +11 -0
- package/dist/client/api/unload-model.js +26 -0
- package/dist/client/index.d.ts +2 -0
- package/dist/client/index.js +1 -0
- package/dist/client/logging-stream-registry.d.ts +5 -0
- package/dist/client/logging-stream-registry.js +60 -0
- package/dist/client/rpc/bare-client.d.ts +112 -0
- package/dist/client/rpc/bare-client.js +82 -0
- package/dist/client/rpc/bare-rpc-client.d.ts +4 -0
- package/dist/client/rpc/bare-rpc-client.js +87 -0
- package/dist/client/rpc/expo-rpc-client.d.ts +3 -0
- package/dist/client/rpc/expo-rpc-client.js +57 -0
- package/dist/client/rpc/node-rpc-client.d.ts +9 -0
- package/dist/client/rpc/node-rpc-client.js +99 -0
- package/dist/client/rpc/rpc-client.d.ts +5 -0
- package/dist/client/rpc/rpc-client.js +91 -0
- package/dist/client/rpc/rpc-error.d.ts +19 -0
- package/dist/client/rpc/rpc-error.js +39 -0
- package/dist/constants/audio.d.ts +3 -0
- package/dist/constants/audio.js +17 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +1 -0
- package/dist/examples/delegated-inference/consumer.d.ts +2 -0
- package/dist/examples/delegated-inference/consumer.js +56 -0
- package/dist/examples/delegated-inference/provider.d.ts +2 -0
- package/dist/examples/delegated-inference/provider.js +57 -0
- package/dist/examples/download-with-cancel.d.ts +2 -0
- package/dist/examples/download-with-cancel.js +46 -0
- package/dist/examples/embed-hyperdrive.d.ts +2 -0
- package/dist/examples/embed-hyperdrive.js +19 -0
- package/dist/examples/kv-cache-example.d.ts +2 -0
- package/dist/examples/kv-cache-example.js +74 -0
- package/dist/examples/llamacpp-file-logging.d.ts +2 -0
- package/dist/examples/llamacpp-file-logging.js +62 -0
- package/dist/examples/llamacpp-filesystem.d.ts +2 -0
- package/dist/examples/llamacpp-filesystem.js +40 -0
- package/dist/examples/llamacpp-http.d.ts +2 -0
- package/dist/examples/llamacpp-http.js +41 -0
- package/dist/examples/llamacpp-hyperdrive.d.ts +2 -0
- package/dist/examples/llamacpp-hyperdrive.js +39 -0
- package/dist/examples/llamacpp-multimodal.d.ts +2 -0
- package/dist/examples/llamacpp-multimodal.js +62 -0
- package/dist/examples/llamacpp-native-tools.d.ts +2 -0
- package/dist/examples/llamacpp-native-tools.js +64 -0
- package/dist/examples/llamacpp-tools-routing.d.ts +2 -0
- package/dist/examples/llamacpp-tools-routing.js +364 -0
- package/dist/examples/llamacpp-tools.d.ts +2 -0
- package/dist/examples/llamacpp-tools.js +81 -0
- package/dist/examples/multi-model-demo.d.ts +2 -0
- package/dist/examples/multi-model-demo.js +75 -0
- package/dist/examples/parallel-download.d.ts +2 -0
- package/dist/examples/parallel-download.js +21 -0
- package/dist/examples/rag/rag-chromadb.d.ts +2 -0
- package/dist/examples/rag/rag-chromadb.js +130 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb-workspaces.js +106 -0
- package/dist/examples/rag/rag-hyperdb.d.ts +2 -0
- package/dist/examples/rag/rag-hyperdb.js +50 -0
- package/dist/examples/rag/rag-lancedb.d.ts +2 -0
- package/dist/examples/rag/rag-lancedb.js +95 -0
- package/dist/examples/rag/rag-sqlite.d.ts +2 -0
- package/dist/examples/rag/rag-sqlite.js +107 -0
- package/dist/examples/seed-hyperdrive.d.ts +2 -0
- package/dist/examples/seed-hyperdrive.js +21 -0
- package/dist/examples/translation/translation-indic.d.ts +2 -0
- package/dist/examples/translation/translation-indic.js +30 -0
- package/dist/examples/translation/translation-llm-context.d.ts +2 -0
- package/dist/examples/translation/translation-llm-context.js +30 -0
- package/dist/examples/translation/translation-llm.d.ts +2 -0
- package/dist/examples/translation/translation-llm.js +38 -0
- package/dist/examples/translation/translation-opus.d.ts +2 -0
- package/dist/examples/translation/translation-opus.js +30 -0
- package/dist/examples/translation/translation-stream.d.ts +2 -0
- package/dist/examples/translation/translation-stream.js +35 -0
- package/dist/examples/whispercpp-filesystem.d.ts +2 -0
- package/dist/examples/whispercpp-filesystem.js +43 -0
- package/dist/examples/whispercpp-microphone-record.d.ts +2 -0
- package/dist/examples/whispercpp-microphone-record.js +311 -0
- package/dist/expo/plugins/index.d.ts +5 -0
- package/dist/expo/plugins/index.js +5 -0
- package/dist/expo/plugins/withMobileBundle.d.ts +8 -0
- package/dist/expo/plugins/withMobileBundle.js +60 -0
- package/dist/expo/plugins/withOpenCL.d.ts +9 -0
- package/dist/expo/plugins/withOpenCL.js +118 -0
- package/dist/expo/plugins/withQvacSDK.d.ts +9 -0
- package/dist/expo/plugins/withQvacSDK.js +13 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/logging/base-logger.d.ts +7 -0
- package/dist/logging/base-logger.js +55 -0
- package/dist/logging/index.d.ts +4 -0
- package/dist/logging/index.js +2 -0
- package/dist/logging/logger.d.ts +5 -0
- package/dist/logging/logger.js +28 -0
- package/dist/logging/stream-logger.d.ts +3 -0
- package/dist/logging/stream-logger.js +9 -0
- package/dist/logging/transport.d.ts +3 -0
- package/dist/logging/transport.js +15 -0
- package/dist/logging/types.d.ts +18 -0
- package/dist/logging/types.js +1 -0
- package/dist/logging/utils.d.ts +4 -0
- package/dist/logging/utils.js +47 -0
- package/dist/models/hyperdrive/index.d.ts +2 -0
- package/dist/models/hyperdrive/index.js +2 -0
- package/dist/models/hyperdrive/models.d.ts +475 -0
- package/dist/models/hyperdrive/models.js +534 -0
- package/dist/schemas/cancel.d.ts +33 -0
- package/dist/schemas/cancel.js +25 -0
- package/dist/schemas/common.d.ts +626 -0
- package/dist/schemas/common.js +47 -0
- package/dist/schemas/completion-stream.d.ts +125 -0
- package/dist/schemas/completion-stream.js +53 -0
- package/dist/schemas/delegate.d.ts +9 -0
- package/dist/schemas/delegate.js +9 -0
- package/dist/schemas/download-asset.d.ts +75 -0
- package/dist/schemas/download-asset.js +43 -0
- package/dist/schemas/embed.d.ts +20 -0
- package/dist/schemas/embed.js +14 -0
- package/dist/schemas/error.d.ts +13 -0
- package/dist/schemas/error.js +35 -0
- package/dist/schemas/index.d.ts +19 -0
- package/dist/schemas/index.js +19 -0
- package/dist/schemas/llamacpp-config.d.ts +30 -0
- package/dist/schemas/llamacpp-config.js +39 -0
- package/dist/schemas/load-model.d.ts +1259 -0
- package/dist/schemas/load-model.js +108 -0
- package/dist/schemas/logging-stream.d.ts +27 -0
- package/dist/schemas/logging-stream.js +16 -0
- package/dist/schemas/ping.d.ts +11 -0
- package/dist/schemas/ping.js +8 -0
- package/dist/schemas/provide.d.ts +43 -0
- package/dist/schemas/provide.js +25 -0
- package/dist/schemas/rag.d.ts +159 -0
- package/dist/schemas/rag.js +78 -0
- package/dist/schemas/transcription.d.ts +24 -0
- package/dist/schemas/transcription.js +15 -0
- package/dist/schemas/translate.d.ts +82 -0
- package/dist/schemas/translate.js +42 -0
- package/dist/schemas/translation-config.d.ts +83 -0
- package/dist/schemas/translation-config.js +46 -0
- package/dist/schemas/unload-model.d.ts +19 -0
- package/dist/schemas/unload-model.js +13 -0
- package/dist/schemas/whispercpp-config.d.ts +25 -0
- package/dist/schemas/whispercpp-config.js +18 -0
- package/dist/server/bare/addons/cancel.d.ts +3 -0
- package/dist/server/bare/addons/cancel.js +12 -0
- package/dist/server/bare/addons/index.d.ts +4 -0
- package/dist/server/bare/addons/index.js +3 -0
- package/dist/server/bare/addons/llamacpp/create-model.d.ts +5 -0
- package/dist/server/bare/addons/llamacpp/create-model.js +57 -0
- package/dist/server/bare/addons/llamacpp/handlers/completion-stream.d.ts +3 -0
- package/dist/server/bare/addons/llamacpp/handlers/completion-stream.js +65 -0
- package/dist/server/bare/addons/llamacpp/handlers/embed.d.ts +4 -0
- package/dist/server/bare/addons/llamacpp/handlers/embed.js +40 -0
- package/dist/server/bare/addons/llamacpp/index.d.ts +4 -0
- package/dist/server/bare/addons/llamacpp/index.js +3 -0
- package/dist/server/bare/addons/llamacpp/kv-cache-utils.d.ts +19 -0
- package/dist/server/bare/addons/llamacpp/kv-cache-utils.js +46 -0
- package/dist/server/bare/addons/load-model.d.ts +3 -0
- package/dist/server/bare/addons/load-model.js +55 -0
- package/dist/server/bare/addons/translation/create-model.d.ts +4 -0
- package/dist/server/bare/addons/translation/create-model.js +45 -0
- package/dist/server/bare/addons/translation/handlers/translate.d.ts +3 -0
- package/dist/server/bare/addons/translation/handlers/translate.js +86 -0
- package/dist/server/bare/addons/translation/index.d.ts +3 -0
- package/dist/server/bare/addons/translation/index.js +2 -0
- package/dist/server/bare/addons/unload-model.d.ts +3 -0
- package/dist/server/bare/addons/unload-model.js +20 -0
- package/dist/server/bare/addons/whispercpp/create-model.d.ts +6 -0
- package/dist/server/bare/addons/whispercpp/create-model.js +55 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +42 -0
- package/dist/server/bare/addons/whispercpp/index.d.ts +3 -0
- package/dist/server/bare/addons/whispercpp/index.js +2 -0
- package/dist/server/bare/delegate-rpc-client.d.ts +4 -0
- package/dist/server/bare/delegate-rpc-client.js +70 -0
- package/dist/server/bare/hyperswarm.d.ts +7 -0
- package/dist/server/bare/hyperswarm.js +62 -0
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +12 -0
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +6 -0
- package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +16 -0
- package/dist/server/bare/rag-hyperdb/handlers/search.d.ts +3 -0
- package/dist/server/bare/rag-hyperdb/handlers/search.js +15 -0
- package/dist/server/bare/rag-hyperdb/index.d.ts +5 -0
- package/dist/server/bare/rag-hyperdb/index.js +4 -0
- package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +5 -0
- package/dist/server/bare/rag-hyperdb/rag-manager.js +61 -0
- package/dist/server/bare/registry/logging-stream-registry.d.ts +12 -0
- package/dist/server/bare/registry/logging-stream-registry.js +46 -0
- package/dist/server/bare/registry/model-registry.d.ts +64 -0
- package/dist/server/bare/registry/model-registry.js +95 -0
- package/dist/server/error-handlers.d.ts +4 -0
- package/dist/server/error-handlers.js +27 -0
- package/dist/server/http-server.d.ts +2 -0
- package/dist/server/http-server.js +189 -0
- package/dist/server/rpc/create-server.d.ts +4 -0
- package/dist/server/rpc/create-server.js +19 -0
- package/dist/server/rpc/handle-request.d.ts +12 -0
- package/dist/server/rpc/handle-request.js +220 -0
- package/dist/server/rpc/handlers/cancelHandler.d.ts +3 -0
- package/dist/server/rpc/handlers/cancelHandler.js +27 -0
- package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +3 -0
- package/dist/server/rpc/handlers/completion-stream-delegated.js +30 -0
- package/dist/server/rpc/handlers/completion-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/completion-stream.js +52 -0
- package/dist/server/rpc/handlers/download-asset.d.ts +3 -0
- package/dist/server/rpc/handlers/download-asset.js +21 -0
- package/dist/server/rpc/handlers/embed.d.ts +3 -0
- package/dist/server/rpc/handlers/embed.js +21 -0
- package/dist/server/rpc/handlers/index.d.ts +23 -0
- package/dist/server/rpc/handlers/index.js +22 -0
- package/dist/server/rpc/handlers/load-model/download-manager.d.ts +31 -0
- package/dist/server/rpc/handlers/load-model/download-manager.js +88 -0
- package/dist/server/rpc/handlers/load-model/http.d.ts +3 -0
- package/dist/server/rpc/handlers/load-model/http.js +337 -0
- package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +4 -0
- package/dist/server/rpc/handlers/load-model/hyperdrive.js +332 -0
- package/dist/server/rpc/handlers/load-model/index.d.ts +4 -0
- package/dist/server/rpc/handlers/load-model/index.js +3 -0
- package/dist/server/rpc/handlers/load-model/resolve.d.ts +3 -0
- package/dist/server/rpc/handlers/load-model/resolve.js +121 -0
- package/dist/server/rpc/handlers/load-model-delegated.d.ts +3 -0
- package/dist/server/rpc/handlers/load-model-delegated.js +93 -0
- package/dist/server/rpc/handlers/load-model.d.ts +3 -0
- package/dist/server/rpc/handlers/load-model.js +41 -0
- package/dist/server/rpc/handlers/logging-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/logging-stream.js +37 -0
- package/dist/server/rpc/handlers/provideHandler/connection.d.ts +3 -0
- package/dist/server/rpc/handlers/provideHandler/connection.js +25 -0
- package/dist/server/rpc/handlers/provideHandler/handler.d.ts +3 -0
- package/dist/server/rpc/handlers/provideHandler/handler.js +50 -0
- package/dist/server/rpc/handlers/provideHandler/proxy.d.ts +3 -0
- package/dist/server/rpc/handlers/provideHandler/proxy.js +22 -0
- package/dist/server/rpc/handlers/provideHandler.d.ts +2 -0
- package/dist/server/rpc/handlers/provideHandler.js +2 -0
- package/dist/server/rpc/handlers/rag.d.ts +3 -0
- package/dist/server/rpc/handlers/rag.js +67 -0
- package/dist/server/rpc/handlers/transcribe-stream.d.ts +3 -0
- package/dist/server/rpc/handlers/transcribe-stream.js +26 -0
- package/dist/server/rpc/handlers/translate.d.ts +3 -0
- package/dist/server/rpc/handlers/translate.js +51 -0
- package/dist/server/rpc/handlers/unload-model.d.ts +3 -0
- package/dist/server/rpc/handlers/unload-model.js +20 -0
- package/dist/server/rpc/index.d.ts +3 -0
- package/dist/server/rpc/index.js +2 -0
- package/dist/server/utils/audio/decoder.d.ts +4 -0
- package/dist/server/utils/audio/decoder.js +41 -0
- package/dist/server/utils/cache.d.ts +15 -0
- package/dist/server/utils/cache.js +32 -0
- package/dist/server/utils/hash.d.ts +5 -0
- package/dist/server/utils/hash.js +11 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/index.js +4 -0
- package/dist/server/utils/model-path.d.ts +5 -0
- package/dist/server/utils/model-path.js +7 -0
- package/dist/server/worker.d.ts +6 -0
- package/dist/server/worker.js +77 -0
- package/dist/utils/withTimeout.d.ts +11 -0
- package/dist/utils/withTimeout.js +37 -0
- package/package.json +129 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RagSearchResult, RagSaveEmbeddingsParams, RagSearchParams, RagDeleteEmbeddingsParams, RagSaveEmbeddingsResult } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* Saves document embeddings in the RAG vector database.
|
|
4
|
+
*
|
|
5
|
+
* @param params - The parameters for saving embeddings
|
|
6
|
+
* @param params.modelId - The identifier of the embedding model to use
|
|
7
|
+
* @param params.documents - The documents to embed and save (string or array of strings)
|
|
8
|
+
* @param params.chunk - Whether to chunk the documents before embedding (default: false)
|
|
9
|
+
* @param params.chunkOpts - Options for chunking documents
|
|
10
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
11
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
12
|
+
* @returns The processed results and dropped indices
|
|
13
|
+
*/
|
|
14
|
+
export declare function ragSaveEmbeddings(params: RagSaveEmbeddingsParams): Promise<{
|
|
15
|
+
processed: RagSaveEmbeddingsResult[];
|
|
16
|
+
droppedIndices: number[];
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Searches for similar documents in the RAG vector database.
|
|
20
|
+
*
|
|
21
|
+
* @param params - The parameters for searching
|
|
22
|
+
* @param params.modelId - The identifier of the embedding model to use
|
|
23
|
+
* @param params.query - The search query text
|
|
24
|
+
* @param params.topK - Number of top results to retrieve (default: 5)
|
|
25
|
+
* @param params.n - Number of centroids to use for IVF index search (default: 3)
|
|
26
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
27
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
28
|
+
* @returns Array of search results with id, content, and score
|
|
29
|
+
*/
|
|
30
|
+
export declare function ragSearch(params: RagSearchParams): Promise<RagSearchResult[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Deletes document embeddings from the RAG vector database.
|
|
33
|
+
*
|
|
34
|
+
* @param params - The parameters for deleting embeddings
|
|
35
|
+
* @param params.modelId - The identifier of the embedding model (must match workspace model)
|
|
36
|
+
* @param params.ids - Array of document IDs to delete
|
|
37
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
38
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
39
|
+
* @returns boolean indicating success
|
|
40
|
+
*/
|
|
41
|
+
export declare function ragDeleteEmbeddings(params: RagDeleteEmbeddingsParams): Promise<true>;
|
|
42
|
+
//# sourceMappingURL=rag.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { send } from "../rpc/rpc-client.js";
|
|
2
|
+
// ============== Save Embeddings ==============
|
|
3
|
+
/**
|
|
4
|
+
* Saves document embeddings in the RAG vector database.
|
|
5
|
+
*
|
|
6
|
+
* @param params - The parameters for saving embeddings
|
|
7
|
+
* @param params.modelId - The identifier of the embedding model to use
|
|
8
|
+
* @param params.documents - The documents to embed and save (string or array of strings)
|
|
9
|
+
* @param params.chunk - Whether to chunk the documents before embedding (default: false)
|
|
10
|
+
* @param params.chunkOpts - Options for chunking documents
|
|
11
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
12
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
13
|
+
* @returns The processed results and dropped indices
|
|
14
|
+
*/
|
|
15
|
+
export async function ragSaveEmbeddings(params) {
|
|
16
|
+
const request = {
|
|
17
|
+
type: "rag",
|
|
18
|
+
operation: "saveEmbeddings",
|
|
19
|
+
...params,
|
|
20
|
+
};
|
|
21
|
+
const response = await send(request);
|
|
22
|
+
if (response.type !== "rag") {
|
|
23
|
+
throw new Error("Invalid response type");
|
|
24
|
+
}
|
|
25
|
+
if (!response.success) {
|
|
26
|
+
throw new Error(response.error ?? "Failed to save embeddings");
|
|
27
|
+
}
|
|
28
|
+
if (response.operation !== "saveEmbeddings") {
|
|
29
|
+
throw new Error("Invalid operation in response");
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
processed: response.processed,
|
|
33
|
+
droppedIndices: response.droppedIndices,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
// ============== Search ==============
|
|
37
|
+
/**
|
|
38
|
+
* Searches for similar documents in the RAG vector database.
|
|
39
|
+
*
|
|
40
|
+
* @param params - The parameters for searching
|
|
41
|
+
* @param params.modelId - The identifier of the embedding model to use
|
|
42
|
+
* @param params.query - The search query text
|
|
43
|
+
* @param params.topK - Number of top results to retrieve (default: 5)
|
|
44
|
+
* @param params.n - Number of centroids to use for IVF index search (default: 3)
|
|
45
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
46
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
47
|
+
* @returns Array of search results with id, content, and score
|
|
48
|
+
*/
|
|
49
|
+
export async function ragSearch(params) {
|
|
50
|
+
const request = {
|
|
51
|
+
type: "rag",
|
|
52
|
+
operation: "search",
|
|
53
|
+
...params,
|
|
54
|
+
topK: params.topK ?? 5,
|
|
55
|
+
n: params.n ?? 3,
|
|
56
|
+
};
|
|
57
|
+
const response = await send(request);
|
|
58
|
+
if (response.type !== "rag") {
|
|
59
|
+
throw new Error("Invalid response type");
|
|
60
|
+
}
|
|
61
|
+
if (!response.success) {
|
|
62
|
+
throw new Error(response.error ?? "Failed to search");
|
|
63
|
+
}
|
|
64
|
+
if (response.operation !== "search") {
|
|
65
|
+
throw new Error("Invalid operation in response");
|
|
66
|
+
}
|
|
67
|
+
return response.results;
|
|
68
|
+
}
|
|
69
|
+
// ============== Delete Embeddings ==============
|
|
70
|
+
/**
|
|
71
|
+
* Deletes document embeddings from the RAG vector database.
|
|
72
|
+
*
|
|
73
|
+
* @param params - The parameters for deleting embeddings
|
|
74
|
+
* @param params.modelId - The identifier of the embedding model (must match workspace model)
|
|
75
|
+
* @param params.ids - Array of document IDs to delete
|
|
76
|
+
* @param params.workspace - Optional workspace for isolated storage
|
|
77
|
+
* @throws {Error} When the response type is invalid or when the operation fails
|
|
78
|
+
* @returns boolean indicating success
|
|
79
|
+
*/
|
|
80
|
+
export async function ragDeleteEmbeddings(params) {
|
|
81
|
+
const request = {
|
|
82
|
+
type: "rag",
|
|
83
|
+
operation: "deleteEmbeddings",
|
|
84
|
+
...params,
|
|
85
|
+
};
|
|
86
|
+
const response = await send(request);
|
|
87
|
+
if (response.type !== "rag") {
|
|
88
|
+
throw new Error("Invalid response type");
|
|
89
|
+
}
|
|
90
|
+
if (!response.success) {
|
|
91
|
+
throw new Error(response.error ?? "Failed to delete embeddings");
|
|
92
|
+
}
|
|
93
|
+
if (response.operation !== "deleteEmbeddings") {
|
|
94
|
+
throw new Error("Invalid operation in response");
|
|
95
|
+
}
|
|
96
|
+
return response.success;
|
|
97
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TranscribeClientParams } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* This function streams audio transcription results in real-time, yielding
|
|
4
|
+
* text chunks as they become available from the model.
|
|
5
|
+
*
|
|
6
|
+
* @param params - The arguments for the transcription
|
|
7
|
+
* @param params.modelId - The identifier of the transcription model to use
|
|
8
|
+
* @param params.audioChunk - Audio input as either a file path (string) or audio buffer
|
|
9
|
+
* @yields {string} Text chunks as they are transcribed
|
|
10
|
+
* @throws {Error} When transcription fails with an error message
|
|
11
|
+
*/
|
|
12
|
+
export declare function transcribeStream(params: TranscribeClientParams): AsyncGenerator<string, void, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* This function provides a simple interface for transcribing audio by
|
|
15
|
+
* collecting all streaming results into a single string response.
|
|
16
|
+
*
|
|
17
|
+
* @param params - The arguments for the transcription
|
|
18
|
+
* @param params.modelId - The identifier of the transcription model to use
|
|
19
|
+
* @param params.audioChunk - Audio input as either a file path (string) or audio buffer
|
|
20
|
+
* @returns {Promise<string>} The complete transcribed text
|
|
21
|
+
* @throws {Error} When transcription fails (propagated from transcribeStream)
|
|
22
|
+
*/
|
|
23
|
+
export declare function transcribe(params: TranscribeClientParams): Promise<string>;
|
|
24
|
+
//# sourceMappingURL=transcribe.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { transcribeStreamResponseSchema, } from "../../schemas/index.js";
|
|
2
|
+
import { stream } from "../rpc/rpc-client.js";
|
|
3
|
+
/**
|
|
4
|
+
* This function streams audio transcription results in real-time, yielding
|
|
5
|
+
* text chunks as they become available from the model.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The arguments for the transcription
|
|
8
|
+
* @param params.modelId - The identifier of the transcription model to use
|
|
9
|
+
* @param params.audioChunk - Audio input as either a file path (string) or audio buffer
|
|
10
|
+
* @yields {string} Text chunks as they are transcribed
|
|
11
|
+
* @throws {Error} When transcription fails with an error message
|
|
12
|
+
*/
|
|
13
|
+
export async function* transcribeStream(params) {
|
|
14
|
+
const request = {
|
|
15
|
+
type: "transcribeStream",
|
|
16
|
+
modelId: params.modelId,
|
|
17
|
+
audioChunk: typeof params.audioChunk === "string"
|
|
18
|
+
? params.audioChunk // File path - send directly
|
|
19
|
+
: params.audioChunk.toString("base64"), // Buffer - encode to base64
|
|
20
|
+
};
|
|
21
|
+
for await (const response of stream(request)) {
|
|
22
|
+
if (response.type === "transcribeStream") {
|
|
23
|
+
const streamResponse = transcribeStreamResponseSchema.parse(response);
|
|
24
|
+
if (streamResponse.error) {
|
|
25
|
+
throw new Error(`Transcription failed: ${streamResponse.error}`);
|
|
26
|
+
}
|
|
27
|
+
if (streamResponse.text) {
|
|
28
|
+
yield streamResponse.text;
|
|
29
|
+
}
|
|
30
|
+
if (streamResponse.done) {
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* This function provides a simple interface for transcribing audio by
|
|
38
|
+
* collecting all streaming results into a single string response.
|
|
39
|
+
*
|
|
40
|
+
* @param params - The arguments for the transcription
|
|
41
|
+
* @param params.modelId - The identifier of the transcription model to use
|
|
42
|
+
* @param params.audioChunk - Audio input as either a file path (string) or audio buffer
|
|
43
|
+
* @returns {Promise<string>} The complete transcribed text
|
|
44
|
+
* @throws {Error} When transcription fails (propagated from transcribeStream)
|
|
45
|
+
*/
|
|
46
|
+
export async function transcribe(params) {
|
|
47
|
+
let fullText = "";
|
|
48
|
+
for await (const textChunk of transcribeStream(params)) {
|
|
49
|
+
fullText += textChunk;
|
|
50
|
+
}
|
|
51
|
+
return fullText;
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type TranslateClientParams, type TranslationStats } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* Translates text from one language to another using a specified translation model.
|
|
4
|
+
* Supports both NMT (Neural Machine Translation) and LLM models.
|
|
5
|
+
*
|
|
6
|
+
* @param params - Translation configuration object
|
|
7
|
+
* @param params.modelId - The identifier of the translation model to use
|
|
8
|
+
* @param params.text - The input text to translate
|
|
9
|
+
* @param params.from - Source language code (optional)
|
|
10
|
+
* @param params.to - Target language code
|
|
11
|
+
* @param params.stream - Whether to stream tokens (true) or return complete response (false). Defaults to true.
|
|
12
|
+
* @returns Object with tokenStream generator and text/stats properties
|
|
13
|
+
* @throws {Error} When translation fails with an error message or when language detection fails
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // Streaming mode (default)
|
|
17
|
+
* const result = translate({
|
|
18
|
+
* modelId: "modelId",
|
|
19
|
+
* text: "Hello world",
|
|
20
|
+
* from: "en",
|
|
21
|
+
* to: "es"
|
|
22
|
+
* modelType: "llm",
|
|
23
|
+
* });
|
|
24
|
+
*
|
|
25
|
+
* for await (const token of result.tokenStream) {
|
|
26
|
+
* console.log(token);
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* // Non-streaming mode
|
|
30
|
+
* const response = translate({
|
|
31
|
+
* modelId: "modelId",
|
|
32
|
+
* text: "Hello world",
|
|
33
|
+
* from: "en",
|
|
34
|
+
* to: "es"
|
|
35
|
+
* modelType: "llm",
|
|
36
|
+
* stream: false,
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* console.log(await response.text);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function translate(params: TranslateClientParams): {
|
|
43
|
+
tokenStream: AsyncGenerator<string>;
|
|
44
|
+
stats: Promise<TranslationStats | undefined>;
|
|
45
|
+
text: Promise<string>;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { stream as streamRpc } from "../rpc/rpc-client.js";
|
|
2
|
+
import { translateResponseSchema, } from "../../schemas/index.js";
|
|
3
|
+
import { detectOne } from "@qvac/langdetect-text";
|
|
4
|
+
/**
|
|
5
|
+
* Translates text from one language to another using a specified translation model.
|
|
6
|
+
* Supports both NMT (Neural Machine Translation) and LLM models.
|
|
7
|
+
*
|
|
8
|
+
* @param params - Translation configuration object
|
|
9
|
+
* @param params.modelId - The identifier of the translation model to use
|
|
10
|
+
* @param params.text - The input text to translate
|
|
11
|
+
* @param params.from - Source language code (optional)
|
|
12
|
+
* @param params.to - Target language code
|
|
13
|
+
* @param params.stream - Whether to stream tokens (true) or return complete response (false). Defaults to true.
|
|
14
|
+
* @returns Object with tokenStream generator and text/stats properties
|
|
15
|
+
* @throws {Error} When translation fails with an error message or when language detection fails
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Streaming mode (default)
|
|
19
|
+
* const result = translate({
|
|
20
|
+
* modelId: "modelId",
|
|
21
|
+
* text: "Hello world",
|
|
22
|
+
* from: "en",
|
|
23
|
+
* to: "es"
|
|
24
|
+
* modelType: "llm",
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* for await (const token of result.tokenStream) {
|
|
28
|
+
* console.log(token);
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* // Non-streaming mode
|
|
32
|
+
* const response = translate({
|
|
33
|
+
* modelId: "modelId",
|
|
34
|
+
* text: "Hello world",
|
|
35
|
+
* from: "en",
|
|
36
|
+
* to: "es"
|
|
37
|
+
* modelType: "llm",
|
|
38
|
+
* stream: false,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* console.log(await response.text);
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function translate(params) {
|
|
45
|
+
let sourceLanguage = params.modelType === "llm" ? params.from : undefined;
|
|
46
|
+
if (!sourceLanguage) {
|
|
47
|
+
const modelType = params.modelType;
|
|
48
|
+
if (modelType === "llm") {
|
|
49
|
+
const detected = detectOne(params.text);
|
|
50
|
+
if (detected.code === "und" || detected.language === "Undetermined") {
|
|
51
|
+
throw new Error("Could not detect the source language. Please specify the 'from' parameter explicitly.");
|
|
52
|
+
}
|
|
53
|
+
sourceLanguage = detected.language;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const request = {
|
|
57
|
+
type: "translate",
|
|
58
|
+
...params,
|
|
59
|
+
...(params.modelType === "llm" && {
|
|
60
|
+
from: sourceLanguage,
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
let stats;
|
|
64
|
+
let statsResolver = () => { };
|
|
65
|
+
const statsPromise = new Promise((resolve) => {
|
|
66
|
+
statsResolver = resolve;
|
|
67
|
+
});
|
|
68
|
+
if (params.stream) {
|
|
69
|
+
const tokenStream = (async function* () {
|
|
70
|
+
for await (const response of streamRpc(request)) {
|
|
71
|
+
if (response.type === "translate") {
|
|
72
|
+
const streamResponse = translateResponseSchema.parse(response);
|
|
73
|
+
if (!streamResponse.done) {
|
|
74
|
+
yield streamResponse.token;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
stats = streamResponse.stats;
|
|
78
|
+
statsResolver(stats);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
})();
|
|
83
|
+
const textPromise = Promise.resolve("");
|
|
84
|
+
return {
|
|
85
|
+
tokenStream,
|
|
86
|
+
text: textPromise,
|
|
87
|
+
stats: statsPromise,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
const tokenStream = (async function* () {
|
|
92
|
+
//Empty generator for non-streaming mode
|
|
93
|
+
})();
|
|
94
|
+
const textPromise = (async () => {
|
|
95
|
+
let buffer = "";
|
|
96
|
+
for await (const response of streamRpc(request)) {
|
|
97
|
+
if (response.type === "translate") {
|
|
98
|
+
const streamResponse = translateResponseSchema.parse(response);
|
|
99
|
+
buffer += streamResponse.token;
|
|
100
|
+
if (streamResponse.done) {
|
|
101
|
+
stats = streamResponse.stats;
|
|
102
|
+
statsResolver(stats);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return buffer;
|
|
107
|
+
})();
|
|
108
|
+
return {
|
|
109
|
+
tokenStream,
|
|
110
|
+
text: textPromise,
|
|
111
|
+
stats: statsPromise,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type UnloadModelParams } from "../../schemas/index";
|
|
2
|
+
/**
|
|
3
|
+
* Unloads a previously loaded model from the server.
|
|
4
|
+
*
|
|
5
|
+
* @param params - The parameters for unloading the model
|
|
6
|
+
* @param params.modelId - The unique identifier of the model to unload
|
|
7
|
+
* @param params.clearStorage - Whether to clear the storage for the model
|
|
8
|
+
* @throws {Error} When the response type is invalid or when the unload operation fails
|
|
9
|
+
*/
|
|
10
|
+
export declare function unloadModel(params: UnloadModelParams): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=unload-model.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {} from "../../schemas/index.js";
|
|
2
|
+
import { send } from "../rpc/rpc-client.js";
|
|
3
|
+
import { stopLoggingStreamForModel } from "../logging-stream-registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* Unloads a previously loaded model from the server.
|
|
6
|
+
*
|
|
7
|
+
* @param params - The parameters for unloading the model
|
|
8
|
+
* @param params.modelId - The unique identifier of the model to unload
|
|
9
|
+
* @param params.clearStorage - Whether to clear the storage for the model
|
|
10
|
+
* @throws {Error} When the response type is invalid or when the unload operation fails
|
|
11
|
+
*/
|
|
12
|
+
export async function unloadModel(params) {
|
|
13
|
+
const request = {
|
|
14
|
+
type: "unloadModel",
|
|
15
|
+
modelId: params.modelId,
|
|
16
|
+
clearStorage: params.clearStorage ?? false,
|
|
17
|
+
};
|
|
18
|
+
const response = await send(request);
|
|
19
|
+
if (response.type !== "unloadModel") {
|
|
20
|
+
throw new Error("Invalid response type");
|
|
21
|
+
}
|
|
22
|
+
if (!response.success) {
|
|
23
|
+
throw new Error("Failed to unload model");
|
|
24
|
+
}
|
|
25
|
+
stopLoggingStreamForModel(params.modelId);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { send, stream } from "./rpc/rpc-client.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Logger } from "../logging/index";
|
|
2
|
+
export declare function startLoggingStreamForModel(modelId: string, logger: Logger): void;
|
|
3
|
+
export declare function stopLoggingStreamForModel(modelId: string): void;
|
|
4
|
+
export declare function hasActiveStreamForModel(modelId: string): boolean;
|
|
5
|
+
//# sourceMappingURL=logging-stream-registry.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import {} from "../logging/index.js";
|
|
2
|
+
import { loggingStream } from "./api/logging-stream.js";
|
|
3
|
+
const activeStreams = new Map();
|
|
4
|
+
export function startLoggingStreamForModel(modelId, logger) {
|
|
5
|
+
if (activeStreams.has(modelId)) {
|
|
6
|
+
console.warn(`Logging stream already active for model ${modelId}`);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const streamIterator = loggingStream({ modelId });
|
|
10
|
+
activeStreams.set(modelId, { logger, streamIterator });
|
|
11
|
+
try {
|
|
12
|
+
void (async () => {
|
|
13
|
+
try {
|
|
14
|
+
for await (const logMessage of streamIterator) {
|
|
15
|
+
const logLevel = logMessage.level;
|
|
16
|
+
switch (logLevel) {
|
|
17
|
+
case "error":
|
|
18
|
+
logger.error(`[${logMessage.namespace}]`, logMessage.message);
|
|
19
|
+
break;
|
|
20
|
+
case "warn":
|
|
21
|
+
logger.warn(`[${logMessage.namespace}]`, logMessage.message);
|
|
22
|
+
break;
|
|
23
|
+
case "info":
|
|
24
|
+
logger.info(`[${logMessage.namespace}]`, logMessage.message);
|
|
25
|
+
break;
|
|
26
|
+
case "debug":
|
|
27
|
+
logger.debug(`[${logMessage.namespace}]`, logMessage.message);
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
logger.info(`[${logMessage.namespace}]`, logMessage.message);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error(`Logging stream error for model ${modelId}:`, error);
|
|
36
|
+
}
|
|
37
|
+
finally {
|
|
38
|
+
activeStreams.delete(modelId);
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error(`Failed to start logging stream for model ${modelId}:`, error);
|
|
44
|
+
activeStreams.delete(modelId);
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export function stopLoggingStreamForModel(modelId) {
|
|
49
|
+
const stream = activeStreams.get(modelId);
|
|
50
|
+
if (stream) {
|
|
51
|
+
activeStreams.delete(modelId);
|
|
52
|
+
// Terminate the stream iterator - this will close the RPC connection
|
|
53
|
+
// and the server-side async generator will automatically terminate
|
|
54
|
+
void stream.streamIterator.return(undefined);
|
|
55
|
+
console.debug(`Stopped logging stream for model ${modelId}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export function hasActiveStreamForModel(modelId) {
|
|
59
|
+
return activeStreams.has(modelId);
|
|
60
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { Request, Response } from "../../schemas/index";
|
|
2
|
+
export declare function send<T extends Request>(request: T): Promise<Response>;
|
|
3
|
+
export declare function stream<T extends Request>(request: T): AsyncGenerator<{
|
|
4
|
+
type: "cancel";
|
|
5
|
+
success: boolean;
|
|
6
|
+
error?: string | undefined;
|
|
7
|
+
} | {
|
|
8
|
+
type: "completionStream";
|
|
9
|
+
token: string;
|
|
10
|
+
done?: boolean | undefined;
|
|
11
|
+
stats?: {
|
|
12
|
+
timeToFirstToken: number;
|
|
13
|
+
tokensPerSecond: number;
|
|
14
|
+
} | undefined;
|
|
15
|
+
error?: string | undefined;
|
|
16
|
+
} | {
|
|
17
|
+
type: "modelProgress";
|
|
18
|
+
downloaded: number;
|
|
19
|
+
total: number;
|
|
20
|
+
percentage: number;
|
|
21
|
+
downloadKey: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: "loadModel";
|
|
24
|
+
success: boolean;
|
|
25
|
+
modelId?: string | undefined;
|
|
26
|
+
error?: string | undefined;
|
|
27
|
+
} | {
|
|
28
|
+
type: "downloadAsset";
|
|
29
|
+
success: boolean;
|
|
30
|
+
assetId?: string | undefined;
|
|
31
|
+
error?: string | undefined;
|
|
32
|
+
} | {
|
|
33
|
+
type: "embed";
|
|
34
|
+
success: boolean;
|
|
35
|
+
embedding: number[];
|
|
36
|
+
error?: string | undefined;
|
|
37
|
+
} | {
|
|
38
|
+
type: "loggingStream";
|
|
39
|
+
modelId: string;
|
|
40
|
+
level: "error" | "warn" | "info" | "debug" | "off";
|
|
41
|
+
namespace: string;
|
|
42
|
+
message: string;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
} | {
|
|
45
|
+
type: "provide";
|
|
46
|
+
success: boolean;
|
|
47
|
+
error?: string | undefined;
|
|
48
|
+
publicKey?: string | undefined;
|
|
49
|
+
} | {
|
|
50
|
+
type: "unloadModel";
|
|
51
|
+
success: boolean;
|
|
52
|
+
error?: string | undefined;
|
|
53
|
+
} | {
|
|
54
|
+
type: "pong";
|
|
55
|
+
number: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: "transcribeStream";
|
|
58
|
+
text?: string | undefined;
|
|
59
|
+
done?: boolean | undefined;
|
|
60
|
+
error?: string | undefined;
|
|
61
|
+
} | {
|
|
62
|
+
type: "translate";
|
|
63
|
+
token: string;
|
|
64
|
+
done?: boolean | undefined;
|
|
65
|
+
stats?: {
|
|
66
|
+
processedTokens: number;
|
|
67
|
+
processingTime: number;
|
|
68
|
+
} | undefined;
|
|
69
|
+
error?: string | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
type: "error";
|
|
72
|
+
message: string;
|
|
73
|
+
stack?: string | undefined;
|
|
74
|
+
timestamp?: string | undefined;
|
|
75
|
+
name?: string | undefined;
|
|
76
|
+
code?: number | undefined;
|
|
77
|
+
cause?: unknown;
|
|
78
|
+
} | {
|
|
79
|
+
type: "rag";
|
|
80
|
+
success: boolean;
|
|
81
|
+
operation: "saveEmbeddings";
|
|
82
|
+
processed: {
|
|
83
|
+
status: "fulfilled" | "rejected";
|
|
84
|
+
id?: string | undefined;
|
|
85
|
+
error?: string | undefined;
|
|
86
|
+
}[];
|
|
87
|
+
droppedIndices: number[];
|
|
88
|
+
error?: string | undefined;
|
|
89
|
+
} | {
|
|
90
|
+
type: "rag";
|
|
91
|
+
success: boolean;
|
|
92
|
+
operation: "search";
|
|
93
|
+
results: {
|
|
94
|
+
id: string;
|
|
95
|
+
content: string;
|
|
96
|
+
score: number;
|
|
97
|
+
}[];
|
|
98
|
+
error?: string | undefined;
|
|
99
|
+
} | {
|
|
100
|
+
type: "rag";
|
|
101
|
+
success: boolean;
|
|
102
|
+
operation: "deleteEmbeddings";
|
|
103
|
+
error?: string | undefined;
|
|
104
|
+
}, void, any>;
|
|
105
|
+
export declare function getRPC(): {
|
|
106
|
+
request(): {
|
|
107
|
+
send(payload: string): void;
|
|
108
|
+
reply(): Promise<Buffer<ArrayBuffer>>;
|
|
109
|
+
createResponseStream(): AsyncGenerator<Buffer<ArrayBuffer>, void, unknown>;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=bare-client.d.ts.map
|