Skip to main content

Models API

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

MethodHTTP requestDescription
modelsCreateNewModelPOST /models/create/models/create [POST]
modelsDeleteSpecificModelPOST /models/{model}/delete/models/{model}/delete [POST]
modelsDeleteSpecificModelCachePOST /models/{model}/delete/cache/models/{model}/delete/cache [POST]
modelsSnapshotGET /models/models [GET]
unloadModelsPOST /models/unload/models/unload [POST]

modelsCreateNewModel

Model modelsCreateNewModel()

Creates a machine learning model. By default, all models created through this endpoint will have the 'custom' attribute set to true. Additionally, the endpoint ensures that no duplicate models exist before creating a new one.

Example

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

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

const body: Pieces.ModelsCreateNewModelRequest = {
// SeededModel | (optional)
seededModel: ,
};

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

Parameters

NameTypeDescriptionNotes
seededModelSeededModel

Return type

Model

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelsDeleteSpecificModel

modelsDeleteSpecificModel()

Deletes a specific model. It is exclusively available for custom models with the 'custom: true' attribute.

Example

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

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

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

apiInstance.modelsDeleteSpecificModel(body).then((data: void (empty response body)) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
model[string]model iddefaults to undefined

Return type

void (empty response body)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
500Internal Server Error-

modelsDeleteSpecificModelCache

ModelDeleteCacheOutput modelsDeleteSpecificModelCache()

Deletes the data associated with a specific model, such as assets or libraries downloaded specifically for this model. Note: This functionality is currently only available for LLM models.

Example

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

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

const body: Pieces.ModelsDeleteSpecificModelCacheRequest = {
// string | model id
model: model_example,
// ModelDeleteCacheInput (optional)
modelDeleteCacheInput: ,
};

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

Parameters

NameTypeDescriptionNotes
modelDeleteCacheInputModelDeleteCacheInput
model[string]model iddefaults to undefined

Return type

ModelDeleteCacheOutput

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

modelsSnapshot

Models modelsSnapshot()

This will get a snapshot of all of your models.

Example

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

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

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

Parameters

This endpoint does not need any parameters.

Return type

Models

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

unloadModels

unloadModels()

Unloads all available machine learning models that are unloadable.

Example

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

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

apiInstance.unloadModels().then((data: void (empty response body)) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

void (empty response body)

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
204No Content-
500Internal Server Error-