cancel( )
Cancels an ongoing operation.
function cancel(params: { modelId: string; operation: "inference" } | { clearCache?: boolean; downloadKey: string; operation: "downloadAsset" } | { operation: "rag"; workspace?: string }): Promise
| Name | Type | Required? | Description |
|---|
params | `{ modelId: string; operation: "inference" } | { clearCache?: boolean; downloadKey: string; operation: "downloadAsset" } | { operation: "rag"; workspace?: string }` |
| Error | When |
|---|
When the response type is invalid or when the cancellation fails | |
// 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" });