API Summary — v0.7.0
One-page reference of all public functions and objects exported by @qvac/sdk
Auto-generated from
.d.tsdeclarations and TSDoc comments.For per-parameter and per-field details, hover symbols in your IDE or open
node_modules/@qvac/sdk/dist. This page is intentionally a high-level index.Fields shown: description, signature, throws, examples, deprecation. Fields intentionally omitted: parameter descriptions, return field descriptions (covered by IDE hover and
.d.tsdeclarations).Scope: 31 functions in
packages/sdk/client/api/.
Functions
cancel
Cancels an ongoing operation.
Signature:
function cancel(params): Promise<void>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"cancel"CANCEL_FAILED— The server reports cancellation failure
completion
Generates completion from a language model based on conversation history.
Signature:
function completion(params): {
tokenStream: AsyncGenerator<string>;
toolCallStream: AsyncGenerator<ToolCallEvent>;
text: Promise<string>;
toolCalls: Promise<ToolCallWithCall[]>;
stats: Promise<CompletionStats | undefined>;
};Throws:
INVALID_TOOLS_ARRAY— Invalid tools array providedINVALID_TOOL_SCHEMA— A tool has an invalid schema
deleteCache
Deletes KV cache files.
Signature:
function deleteCache(params): Promise<{ success: boolean }>;Throws:
INVALID_DELETE_CACHE_PARAMS— NeitherallnorkvCacheKeywas providedDELETE_CACHE_FAILED— The server reports cache deletion failure
downloadAsset
Downloads an asset (model file) without loading it into memory.
Signature:
function downloadAsset(options): Promise<string>;Throws:
DOWNLOAD_ASSET_FAILED— The download operation failsSTREAM_ENDED_WITHOUT_RESPONSE— Streaming ends without a final response (when usingonProgress)INVALID_RESPONSE_TYPE— Response type does not match expected"downloadAsset"
embed
Generates embeddings for a single text using a specified model.
Signature:
function embed(params: { modelId: string; text: string }): Promise<number[]>;
function embed(params: { modelId: string; text: string[] }): Promise<number[][]>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"embed"
getModelInfo
Retrieves detailed information about a model, including cache status and loaded instances.
Signature:
function getModelInfo(params): Promise<ModelInfo>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"getModelInfo"
invokePlugin
Invoke a non-streaming plugin handler.
Signature:
function invokePlugin<TResponse = unknown, TParams = unknown>(
options: InvokePluginOptions<TParams>
): Promise<TResponse>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"pluginInvoke"
invokePluginStream
Invoke a streaming plugin handler.
Signature:
function invokePluginStream<TResponse = unknown, TParams = unknown>(
options: InvokePluginOptions<TParams>
): AsyncGenerator<TResponse>;Throws:
INVALID_RESPONSE_TYPE— A chunk's type does not match expected"pluginInvokeStream"
loadModel
Loads a machine learning model from a local path, remote URL, or Hyperdrive key.
Signature:
// Load new model
function loadModel(options: LoadModelOptions): Promise<string>;
// Hot-reload config on an already-loaded model
function loadModel(options: ReloadConfigOptions): Promise<string>;Throws:
MODEL_LOAD_FAILED— Model loading failsSTREAM_ENDED_WITHOUT_RESPONSE— Streaming ends without a final response (when usingonProgress)INVALID_RESPONSE_TYPE— Response type does not match expected"loadModel"
loggingStream
Opens a logging stream to receive real-time logs.
Signature:
function loggingStream(params): AsyncGenerator<LoggingStreamResponse>;Throws:
INVALID_RESPONSE_TYPE— A chunk's type does not match expected"loggingStream"
modelRegistryGetModel
Retrieves a single model entry from the QVAC model registry by path and source.
Signature:
function modelRegistryGetModel(registryPath: string, registrySource: string): Promise<ModelRegistryEntry>;Throws:
QVAC_MODEL_REGISTRY_QUERY_FAILED— The registry query fails or model is not found
modelRegistryList
Lists all available models from the QVAC model registry.
Signature:
function modelRegistryList(): Promise<ModelRegistryEntry[]>;Throws:
QVAC_MODEL_REGISTRY_QUERY_FAILED— The registry query fails
modelRegistrySearch
Searches the QVAC model registry with optional filters.
Signature:
function modelRegistrySearch(params?): Promise<ModelRegistryEntry[]>;Throws:
QVAC_MODEL_REGISTRY_QUERY_FAILED— The registry query fails
ocr
Performs Optical Character Recognition (OCR) on an image to extract text.
Signature:
function ocr(params): {
blockStream: AsyncGenerator<OCRTextBlock[]>;
blocks: Promise<OCRTextBlock[]>;
stats: Promise<OCRStats | undefined>;
};ping
Sends a ping request to the server and returns the pong response.
Signature:
function ping(): Promise<{ type: "pong"; number: number }>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"pong"
ragChunk
Chunks documents into smaller pieces for embedding.
Signature:
function ragChunk(params): Promise<RagDoc[]>;Throws:
RAG_CHUNK_FAILED— The chunking operation fails
ragCloseWorkspace
Closes a RAG workspace, releasing in-memory resources (Corestore, HyperDB adapter, RAG instance).
Signature:
function ragCloseWorkspace(params?): Promise<void>;Throws:
RAG_WORKSPACE_CLOSE_FAILED— The close operation fails
ragDeleteEmbeddings
Deletes document embeddings from the RAG vector database.
Signature:
function ragDeleteEmbeddings(params): Promise<void>;Throws:
RAG_DELETE_FAILED— The delete operation fails or workspace doesn't exist
ragDeleteWorkspace
Deletes a RAG workspace and all its data.
Signature:
function ragDeleteWorkspace(params): Promise<void>;Throws:
RAG_DELETE_FAILED— The workspace doesn't exist or is currently loaded
ragIngest
Ingests documents into the RAG vector database.
Signature:
function ragIngest(params): Promise<{ processed: RagSaveEmbeddingsResult[]; droppedIndices: number[] }>;Throws:
RAG_SAVE_FAILED— The ingestion operation failsSTREAM_ENDED_WITHOUT_RESPONSE— Streaming ends unexpectedly (when usingonProgress)
ragListWorkspaces
Lists all RAG workspaces with their open status.
Signature:
function ragListWorkspaces(): Promise<RagWorkspaceInfo[]>;Throws:
RAG_LIST_WORKSPACES_FAILED— The operation fails
ragReindex
Reindexes the RAG database to optimize search performance.
Signature:
function ragReindex(params): Promise<RagReindexResult>;Throws:
RAG_SAVE_FAILED— The reindex operation fails or workspace doesn't existSTREAM_ENDED_WITHOUT_RESPONSE— Streaming ends unexpectedly (when usingonProgress)
ragSaveEmbeddings
Saves pre-embedded documents to the RAG vector database.
Signature:
function ragSaveEmbeddings(params): Promise<RagSaveEmbeddingsResult[]>;Throws:
RAG_SAVE_FAILED— The save operation failsSTREAM_ENDED_WITHOUT_RESPONSE— Streaming ends unexpectedly (when usingonProgress)
ragSearch
Searches for similar documents in the RAG vector database.
Signature:
function ragSearch(params): Promise<RagSearchResult[]>;Throws:
RAG_SEARCH_FAILED— The search operation fails
startQVACProvider
Starts a provider service that offers QVAC capabilities to remote peers.
Signature:
function startQVACProvider(params): Promise<object>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"provide"PROVIDER_START_FAILED— The server reports provider start failure
stopQVACProvider
Stops a running provider service and leaves the specified topic.
Signature:
function stopQVACProvider(params): Promise<object>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"stopProvide"PROVIDER_STOP_FAILED— The server reports provider stop failure
textToSpeech
Converts text to speech audio.
Signature:
function textToSpeech(params): {
bufferStream: AsyncGenerator<number>;
buffer: Promise<number[]>;
done: Promise<boolean>;
};transcribe
Provides a simple interface for transcribing audio by collecting all streaming results into a single string response.
Signature:
function transcribe(params): Promise<string>;Throws:
TRANSCRIPTION_FAILED— Transcription fails
Example:
const text = await transcribe({
modelId: "whisper-model",
audioChunk: "/path/to/audio.wav",
});
console.log(text);transcribeStream
Streams audio transcription results in real-time, yielding text chunks as they become available from the model.
Signature:
function transcribeStream(params): AsyncGenerator<string>;Throws:
TRANSCRIPTION_FAILED— Transcription fails
Example:
const stream = transcribeStream({
modelId: "whisper-model",
audioChunk: "/path/to/audio.wav",
});
for await (const textChunk of stream) {
process.stdout.write(textChunk);
}translate
Translates text from one language to another using a specified translation model.
Signature:
function translate(params): {
tokenStream: AsyncGenerator<string>;
text: Promise<string>;
stats: Promise<TranslationStats | undefined>;
};Throws:
TRANSLATION_FAILED— Translation fails
unloadModel
Unloads a previously loaded model from the server.
Signature:
function unloadModel(params): Promise<void>;Throws:
INVALID_RESPONSE_TYPE— Response type does not match expected"unloadModel"MODEL_UNLOAD_FAILED— The server reports unload failure
Errors
Public error codes thrown across the SDK. Catch via instanceof QvacErrorBase
and read error.code / error.cause. Code ranges:
50,001–52,000 (client) and 52,001–54,000 (server).
Client errors
| Error | Code | Summary |
|---|---|---|
INVALID_RESPONSE_TYPE | 50001 | Invalid response type received. |
INVALID_OPERATION_IN_RESPONSE | 50002 | Response operation didn't match the expected RAG operation. |
STREAM_ENDED_WITHOUT_RESPONSE | 50003 | Streaming RPC ended without a final response. |
INVALID_AUDIO_CHUNK_TYPE | 50004 | Invalid audio chunk input type provided. |
INVALID_TOOLS_ARRAY | 50005 | Invalid tools array provided. |
INVALID_TOOL_SCHEMA | 50006 | Invalid tool schema provided. |
OCR_FAILED | 50007 | OCR operation failed. |
RPC_CONNECTION_FAILED | 50203 | RPC connection failed. |
PROVIDER_START_FAILED | 50400 | Failed to start provider. |
PROVIDER_STOP_FAILED | 50401 | Failed to stop provider. |
DELEGATE_NO_FINAL_RESPONSE | 50402 | No final response received from delegated provider. |
DELEGATE_CONNECTION_FAILED | 50404 | Failed to connect to delegated provider. |
CONFIG_FILE_PARSE_FAILED | 50604 | Failed to import/parse a qvac.config.* file. |