Skip to main content

Model API

All URIs are relative to http://localhost:1000

MethodHTTP requestDescription
modelSpecificModelDownloadPOST /model/{model}/download/model/{model}/download [POST]
modelSpecificModelDownloadCancelPOST /model/{model}/download/cancel/model/{model}/download/cancel [POST]
modelSpecificModelDownloadProgressGET /model/{model}/download/progress/model/{model}/download/progress [WS]
modelSpecificModelLoadPOST /model/{model}/load/model/{model}/load [POST]
modelSpecificModelUnloadPOST /model/{model}/unload/model/{model}/unload [POST]
modelUpdatePOST /model/update/model/update [POST]
modelsSpecificModelSnapshotGET /model/{model}/model/{model} [GET]

modelSpecificModelDownload

Model modelSpecificModelDownload()

Downloads a specific model to your local machine.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelSpecificModelDownloadRequest = {
// string | model id
model: model_example,
};

apiInstance.modelSpecificModelDownload(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

Model

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelSpecificModelDownloadCancel

Model modelSpecificModelDownloadCancel()

Cancels a specific model download that is currently in progress.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelSpecificModelDownloadCancelRequest = {
// string | model id
model: model_example,
};

apiInstance.modelSpecificModelDownloadCancel(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

Model

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelSpecificModelDownloadProgress

ModelDownloadProgress modelSpecificModelDownloadProgress()

This is a WebSocket connection that provides real-time updates on the download progress of a specific model.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelSpecificModelDownloadProgressRequest = {
// string | model id
model: model_example,
};

apiInstance.modelSpecificModelDownloadProgress(body).then((data: ModelDownloadProgress) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

ModelDownloadProgress

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelSpecificModelLoad

Model modelSpecificModelLoad()

Loads a previously downloaded model into memory. It differs from downloading, as downloading involves transferring the entire model to your machine, while loading simply loads the model into memory.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelSpecificModelLoadRequest = {
// string | model id
model: model_example,
};

apiInstance.modelSpecificModelLoad(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

Model

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelSpecificModelUnload

Model modelSpecificModelUnload()

Unloads a previously loaded model from memory and effectively frees up the RAM consumed by the model.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelSpecificModelUnloadRequest = {
// string | model id
model: model_example,
};

apiInstance.modelSpecificModelUnload(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

Model

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelUpdate

Model modelUpdate()

Updates a machine learning model. This functionality is exclusively available for models with the 'custom:true' setting.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelUpdateRequest = {
// Model (optional)
model: ,
};

apiInstance.modelUpdate(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
modelModel

Return type

Model

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelsSpecificModelSnapshot

Model modelsSpecificModelSnapshot()

Retrieves a specific ML model.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.ModelApi(configuration)

const body: Pieces.ModelsSpecificModelSnapshotRequest = {
// string | model id
model: model_example,
};

apiInstance.modelsSpecificModelSnapshot(body).then((data: Model) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

Model

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
410model was not found.-