cancel( )
Cancels an ongoing operation.
function cancel(params): Promise<void>;
| Name | Type | Required? | Description |
|---|
| params | CancelParams | ✓ | The parameters for the cancellation |
Discriminated union on operation. One of:
| Field | Type | Required? | Description |
|---|
| operation | "inference" | ✓ | Operation type |
| modelId | string | ✓ | The model ID to cancel inference for |
| Field | Type | Required? | Default | Description |
|---|
| operation | "downloadAsset" | ✓ | — | Operation type |
| downloadKey | string | ✓ | — | The download key to cancel |
| clearCache | boolean | ✗ | false | If true, deletes the partial download file |
| Field | Type | Required? | Default | Description |
|---|
| operation | "rag" | ✓ | — | Operation type |
| workspace | string | ✗ | "default" | The RAG workspace to cancel |
Promise<void> — Resolves when the operation is cancelled.
| Error | When |
|---|
INVALID_RESPONSE_TYPE | Response type does not match expected "cancel" |
CANCEL_FAILED | The server reports cancellation failure |
// Cancel inference
await cancel({ operation: "inference", modelId: "model-123" });
// Pause download (preserves partial file for automatic resume)
await cancel({ operation: "downloadAsset", downloadKey: "download-key" });
// Cancel download completely (deletes partial file)
await cancel({ operation: "downloadAsset", downloadKey: "download-key", clearCache: true });
// Cancel RAG operation on default workspace
await cancel({ operation: "rag" });
// Cancel RAG operation on specific workspace
await cancel({ operation: "rag", workspace: "my-workspace" });