Node.js API Reference
Clarifai Node.js API Reference
This is the API Reference documentation extracted from the source code.
App
App is a class that provides access to Clarifai API endpoints related to App information.
This is its hierarchy:
-
Lister↳
App
Constructor
• new App(config): App
Initializes an App object.
Example
import { App } from "clarifai-nodejs";
export const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
Parameters
| Name | Type | Description |
|---|---|---|
config | AppConfig | The configuration object for the App. |
Returns
App
Overrides
Lister.constructor
Defined in
Properties
appInfo
• Private appInfo: App
Defined in
info
• info: AsObject
Defined in
Methods
createDataset
▸ createDataset(«destructured»): Promise<AsObject>
Creates a dataset for the app.
Example
import { Input, App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const dataset = await app.createDataset({
datasetId: "dog-image-collection",
});
// Dataset is created, now let's build an image input that uses the new dataset id
const inputProto = Input.getInputFromUrl({
datasetId: dataset.id,
inputId: "dog-tiff",
imageUrl: "https://samples.clarifai.com/dog.tiff",
labels: ["dog"],
geoInfo: {
latitude: 40,
longitude: -30,
},
metadata: { Breed: "Saint Bernard" },
});
const input = new Input({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
// upload the input by using instance of the Input class
// this input will be stored under the newly created dataset
const inputJobId = await input.uploadInputs({
inputs: [inputProto],
});
console.log(inputJobId); // job id of the input upload
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› datasetId | string |
› params? | CreateDatasetParam |
Returns
Promise<AsObject>
A Dataset object for the specified dataset ID.
Defined in
createModel
▸ createModel(«destructured»): Promise<AsObject>
Creates a model for the app.
Example
import { Model, App } from "clarifai-nodejs";
import {
ModelVersion,
OutputInfo,
} from "clarifai-nodejs-grpc/proto/clarifai/api/resources_pb";
import { Struct } from "google-protobuf/google/protobuf/struct_pb.js";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
// Creating a new image crop model
const newModelObject = await app.createModel({
modelId: "margin-100-image-cropper",
params: {
modelTypeId: "image-crop",
description: "Custom crop model with 100px margin",
},
});
// Initializing the newly created model
const model = new Model({
modelId: newModelObject.id,
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
// Creating a GRPC compatible outputInfo object with custom margin parameters
const outputInfo = new OutputInfo().setParams(
Struct.fromJavaScript({ margin: 1.5 }),
);
// GRPC compatible ModelVersion object with previously created output info config
const modelVersion = new ModelVersion()
.setDescription("Setting output info margin parameters to 1.5")
.setOutputInfo(outputInfo);
// Creating a new version of the model with previously created output info config
const modelObjectWithVersion = await model.createVersion(modelVersion);
console.log(modelObjectWithVersion);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› modelId | string |
› params? | CreateModelParam |
Returns
Promise<AsObject>
A Model object for the specified model ID.
Defined in
createModule
▸ createModule(«destructured»): Promise<AsObject>
Creates a module for the app.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const module = await app.createModule({
moduleId: "new-module",
description: "New module",
});
console.log(module);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› description | string |
› moduleId | string |
Returns
Promise<AsObject>
A Module object for the specified module ID.
Defined in
createWorkflow
▸ createWorkflow(«destructured»): Promise<AsObject>
Creates a workflow for the app.
Example
import { App } from "clarifai-nodejs";
import path from "path";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const workflowFile = path.resolve(__dirname, "workflow/moderation.yml");
const workflow = await app.createWorkflow({ configFilePath: workflowFile });
console.log(workflow);
/**
* Workflow config file in the path `workflow/moderation.yml`:
*/
/*
workflow:
id: test-mbmn
nodes:
- id: detector
model:
modelId: face-detection
modelVersionId: 45fb9a671625463fa646c3523a3087d5
- id: cropper
model:
modelId: margin-110-image-crop
modelVersionId: b9987421b40a46649566826ef9325303
nodeInputs:
- nodeId: detector
- id: face-sentiment
model:
modelId: face-sentiment-recognition
modelVersionId: a5d7776f0c064a41b48c3ce039049f65
nodeInputs:
- nodeId: cropper
- id: moderation
model:
modelId: moderation-recognition
modelVersionId: 7cde8e92896340b0998b8260d47f1502
*/
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› configFilePath | string | undefined |
› display? | boolean | true |
› generateNewId? | boolean | false |
Returns
Promise<AsObject>
A Workflow object for the specified workflow config.
Defined in
dataset
▸ dataset(dataset_id): Promise<undefined | AsObject>
Returns a Dataset object for the existing dataset ID.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const dataset = await app.dataset({
datasetId: "dataset-id",
});
console.log(dataset);
Parameters
| Name | Type | Description |
|---|---|---|
dataset_id | Object | The dataset ID for the dataset to interact with. |
dataset_id.datasetId | string | - |
Returns
Promise<undefined | AsObject>
A Dataset object for the existing dataset ID.
Defined in
deleteDataset
▸ deleteDataset(datasetId): Promise<void>
Deletes a dataset for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
await app.deleteDataset({ datasetId: "dataset-id" });
Parameters
| Name | Type | Description |
|---|---|---|
datasetId | Object | The dataset ID for the app to delete. |
datasetId.datasetId | string | - |
Returns
Promise<void>
Defined in
deleteModel
▸ deleteModel(modelId): Promise<void>
Deletes a model for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
await app.deleteModel({ modelId: "modelId" });
Parameters
| Name | Type | Description |
|---|---|---|
modelId | Object | The model ID for the model to delete. |
modelId.modelId | string | - |
Returns
Promise<void>
Defined in
deleteModule
▸ deleteModule(moduleId): Promise<void>
Deletes a module for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
await app.deleteModule({ moduleId: "moduleId" });
Parameters
| Name | Type | Description |
|---|---|---|
moduleId | Object | The module ID for the module to delete. |
moduleId.moduleId | string | - |
Returns
Promise<void>
Defined in
deleteWorkflow
▸ deleteWorkflow(workflowId): Promise<void>
Deletes a workflow for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
await app.deleteWorkflow({ workflowId: "workflowId" });
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | Object | The workflow ID for the workflow to delete. |
workflowId.workflowId | string | - |
Returns
Promise<void>
Defined in
listConcepts
▸ listConcepts(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all the concepts for the app.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listConcepts().next();
const concepts = list.value;
console.log(concepts);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› pageNo? | number |
› perPage? | number |
Returns
AsyncGenerator<AsObject[], void, unknown>
Yields
Concepts in the app.
Defined in
listDataSets
▸ listDataSets(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all the datasets for the app.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listDataSets().next();
const datasets = list.value;
console.log(datasets);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› pageNo? | number |
› params? | ListDatasetsParam |
› perPage? | number |
Returns
AsyncGenerator<AsObject[], void, unknown>
Yields
Dataset - Dataset objects for the datasets in the app.
Notes
Defaults to 16 per page
Defined in
listInstalledModuleVersions
▸ listInstalledModuleVersions(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all installed module versions in the app.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listInstalledModuleVersions().next();
const moduleVersions = list.value;
console.log(moduleVersions);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› pageNo? | number |
› params? | ListInstalledModuleVersionsParam |
› perPage? | number |
Returns
AsyncGenerator<AsObject[], void, unknown>
Yields
Module - Module objects for the installed module versions in the app.
Notes
Defaults to 16 per page
Defined in
listModels
▸ listModels(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all the available models for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listModels().next();
const models = list.value;
console.log(models);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | {} |
› onlyInApp? | boolean | true |
› pageNo? | number | undefined |
› params? | ListModelsParam | {} |
› perPage? | number | undefined |
Returns
AsyncGenerator<AsObject[], void, unknown>
Notes
Defaults to 16 per page
Defined in
listModules
▸ listModules(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all the available modules for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listModules().next();
const modules = list.value;
console.log(modules);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› onlyInApp? | boolean |
› pageNo? | number |
› params? | ListModulesParam |
› perPage? | number |
Returns
AsyncGenerator<AsObject[], void, unknown>
Yields
Module - Module objects for the modules in the app.
Notes
Defaults to 16 per page
Defined in
listTrainableModelTypes
▸ listTrainableModelTypes(): string[]
Returns
string[]
Defined in
listWorkflows
▸ listWorkflows(«destructured»?): AsyncGenerator<AsObject[], void, unknown>
Lists all the available workflows for the user.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const list = await app.listWorkflows().next();
const workflows = list.value;
console.log(workflows);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | {} |
› onlyInApp? | boolean | true |
› pageNo? | number | undefined |
› params? | ListWorkflowsParam | {} |
› perPage? | number | undefined |
Returns
AsyncGenerator<AsObject[], void, unknown>
Yields
Workflow - Workflow objects for the workflows in the app.
Notes
Defaults to 16 per page
Defined in
model
▸ model(«destructured»): Promise<undefined | AsObject>
Returns a Model object for the existing model ID.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const model = await app.model({
modelId: "custom-crop-model",
modelVersionId: "0.0.1",
});
console.log(model);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› modelId | string |
› modelUserAppId? | Object |
› modelUserAppId.appId | string |
› modelUserAppId.userId | string |
› modelVersionId? | string |
Returns
Promise<undefined | AsObject>
A model object for the specified model ID.
Defined in
workflow
▸ workflow(workflowId): Promise<undefined | AsObject>
Returns a Workflow object for the existing workflow ID.
Example
import { App } from "clarifai-nodejs";
const app = new App({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const workflow = await app.workflow({ workflowId: "workflowId" });
console.log(workflow);
Parameters
| Name | Type | Description |
|---|---|---|
workflowId | Object | The workflow ID for a existing workflow. |
workflowId.workflowId | string | - |
Returns
Promise<undefined | AsObject>
A workflow object for the specified workflow ID.
Defined in
Dataset
Dataset is a class that provides access to Clarifai API endpoints related to Dataset information.
This is its hierarchy:
-
Lister↳
Dataset
Constructor
• new Dataset(«destructured»): Dataset
Parameters
| Name | Type |
|---|---|
«destructured» | DatasetConfig |
Returns
Dataset
Overrides
Lister.constructor
Defined in
Properties
STUB
• Protected STUB: V2Stub
Inherited from
Lister.STUB
Defined in
authHelper
• Protected authHelper: ClarifaiAuthHelper
Inherited from
Lister.authHelper
Defined in
base
• Protected base: string
Inherited from
Lister.base
Defined in
batchSize
• Private batchSize: number = 128
Defined in
defaultPageSize
• defaultPageSize: number
Inherited from
Lister.defaultPageSize
Defined in
info
• Private info: Dataset
Defined in
input
• Private input: Input
Defined in
metadata
• Protected metadata: [string, string][]
Inherited from
Lister.metadata
Defined in
pat
• Protected pat: string
Inherited from
Lister.pat
Defined in
rootCertificatesPath
• Protected rootCertificatesPath: string
Inherited from
Lister.rootCertificatesPath
Defined in
userAppId
• Protected userAppId: UserAppIDSet
Inherited from
Lister.userAppId
Defined in
Methods
convertStringToTimestamp
▸ convertStringToTimestamp(dateStr): Timestamp
Converts a string to a Timestamp object.
Parameters
| Name | Type | Description |
|---|---|---|
dateStr | string | The string to convert. |
Returns
Timestamp
A Timestamp object representing the given date string.
Inherited from
Lister.convertStringToTimestamp
Defined in
createVersion
▸ createVersion(«destructured»): Promise<AsObject>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› description | string |
› id | string |
› metadata? | Record<string, JavaScriptValue> |
Returns
Promise<AsObject>
Defined in
deleteVersion
▸ deleteVersion(versionId): Promise<void>
Parameters
| Name | Type |
|---|---|
versionId | string |
Returns
Promise<void>
Defined in
grpcRequest
▸ grpcRequest<TRequest, TResponseObject, TResponse>(endpoint, requestData): Promise<TResponse>
Makes a gRPC request to the API.
Type parameters
| Name | Type |
|---|---|
TRequest | extends Message |
TResponseObject | extends Object |
TResponse | extends Object |
Parameters
| Name | Type |
|---|---|
endpoint | (request: TRequest, metadata: Metadata, options: Partial<CallOptions>) => Promise<TResponse> |
requestData | TRequest |
Returns
Promise<TResponse>
A Promise resolving to the result of the gRPC method call.
Inherited from
Lister.grpcRequest
Defined in
listPagesData
▸ listPagesData<TRequest, TResponseObject, TResponse>(endpoint, requestData, pageNo?, perPage?): Promise<TResponse>
Type parameters
| Name | Type |
|---|---|
TRequest | extends Message |
TResponseObject | extends Object |
TResponse | extends Object |
Parameters
| Name | Type | Default value |
|---|---|---|
endpoint | (request: TRequest, metadata: Metadata, options: Partial<CallOptions>) => Promise<TResponse> | undefined |
requestData | TRequest | undefined |
pageNo | number | 1 |
perPage | number | undefined |
Returns
Promise<TResponse>
Inherited from
Lister.listPagesData
Defined in
listPagesGenerator
▸ listPagesGenerator<TRequest, TResponseObject, TResponse>(endpoint, requestData, pageNo?, perPage?): AsyncGenerator<TResponse, void, unknown>
Type parameters
| Name | Type |
|---|---|
TRequest | extends Message |
TResponseObject | extends Object |
TResponse | extends Object |
Parameters
| Name | Type | Default value |
|---|---|---|
endpoint | (request: TRequest, metadata: Metadata, options: Partial<CallOptions>) => Promise<TResponse> | undefined |
requestData | TRequest | undefined |
pageNo | number | 1 |
perPage | number | undefined |
Returns
AsyncGenerator<TResponse, void, unknown>
Inherited from
Lister.listPagesGenerator
Defined in
listVersions
▸ listVersions(pageNo?, perPage?): AsyncGenerator<AsObject[], void, unknown>
Parameters
| Name | Type |
|---|---|
pageNo? | number |
perPage? | number |
Returns
AsyncGenerator<AsObject[], void, unknown>
Defined in
uploadFromCSV
▸ uploadFromCSV(«destructured»): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› batchSize? | number | 128 |
› csvPath | string | undefined |
› csvType | "url" | "raw" | "file" | undefined |
› inputType? | "image" | "text" | "video" | "audio" | "text" |
› labels? | boolean | true |
› uploadProgressEmitter? | InputBulkUpload | undefined |
Returns
Promise<void>
Defined in
uploadFromFolder
▸ uploadFromFolder(«destructured»): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› batchSize? | number | undefined |
› folderPath | string | undefined |
› inputType | "image" | "text" | undefined |
› labels? | boolean | false |
› uploadProgressEmitter? | InputBulkUpload | undefined |
Returns
Promise<void>
Defined in
Input
Input is a class that provides access to Clarifai API endpoints related to Input information.
This is its hierarchy:
-
Lister↳
Input
Constructor
• new Input(params): Input
Initializes an input object.
Example
import { Input } from "clarifai-nodejs";
export const input = new Input({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
Parameters
| Name | Type | Description |
|---|---|---|
params | Object | The parameters for the Input object. |
params.authConfig? | AuthConfig | - |
Returns
Input
Overrides
Lister.constructor
Defined in
Properties
numOfWorkers
• Private numOfWorkers: number
Defined in
Methods
bulkUpload
▸ bulkUpload(«destructured»): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› batchSize? | number | 128 |
› inputs | Input[] | undefined |
› uploadProgressEmitter? | InputBulkUpload | undefined |
Returns
Promise<void>
Defined in
deleteFailedInputs
▸ deleteFailedInputs(«destructured»): Promise<Input[]>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inputs | Input[] |
Returns
Promise<Input[]>
Defined in
patchInputs
▸ patchInputs(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› action? | string | "merge" |
› inputs | Input[] | undefined |
Returns
Promise<string>
Defined in
retryUploads
▸ retryUploads(«destructured»): Promise<void>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› failedInputs | Input[] |
Returns
Promise<void>
Defined in
uploadAnnotations
▸ uploadAnnotations(«destructured»): Promise<Annotation[]>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› batchAnnot | Annotation[] | undefined |
› showLog? | boolean | true |
Returns
Promise<Annotation[]>
Defined in
uploadBatch
▸ uploadBatch(«destructured»): Promise<Input[]>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inputs | Input[] |
Returns
Promise<Input[]>
Defined in
uploadFromBytes
▸ uploadFromBytes(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioBytes? | null | Uint8Array | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageBytes? | null | Uint8Array | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textBytes? | null | Uint8Array | null |
› videoBytes? | null | Uint8Array | null |
Returns
Promise<string>
Defined in
uploadFromFile
▸ uploadFromFile(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioFile? | null | string | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageFile? | null | string | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textFile? | null | string | null |
› videoFile? | null | string | null |
Returns
Promise<string>
Defined in
uploadFromUrl
▸ uploadFromUrl(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioUrl? | null | string | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageUrl? | null | string | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textUrl? | null | string | null |
› videoUrl? | null | string | null |
Returns
Promise<string>
Defined in
uploadInputs
▸ uploadInputs(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› inputs | Input[] | undefined |
› showLog? | boolean | true |
Returns
Promise<string>
Defined in
uploadText
▸ uploadText(«destructured»): Promise<string>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› datasetId? | null | string | null |
› inputId | string | undefined |
› rawText | string | undefined |
Returns
Promise<string>
Defined in
waitForInputs
▸ waitForInputs(«destructured»): Promise<boolean>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inputJobId | string |
Returns
Promise<boolean>
Defined in
getBboxProto
▸ getBboxProto(«destructured»): Annotation
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› bbox | number[] |
› inputId | string |
› label | string |
Returns
Annotation
Defined in
getImageInputsFromFolder
▸ getImageInputsFromFolder(«destructured»): Input[]
Upload image inputs from folder.
Example
import { Input, Model } from "clarifai-nodejs";
import path from "path";
// Generate a new GRPC compatible Input object from buffer
const imageInputs = Input.getImageInputsFromFolder({
// Ensure the directory contains a list of images
folderPath: path.resolve(__dirname, "path/to/imageFolder"),
});
// The input can now be used as an input for a model prediction methods
const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
modelId: "multimodal-clip-embed",
});
const prediction = await model.predict({
inputs: imageInputs,
});
console.log(prediction);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› datasetId? | null | string | null |
› folderPath | string | undefined |
› labels? | boolean | false |
Returns
Input[]
Defined in
getInputFromBytes
▸ getInputFromBytes(«destructured»): Input
Creates an input proto from bytes.
Example
import { Input, Model } from "clarifai-nodejs";
import * as fs from "fs";
const imageBuffer = fs.readFileSync("path/to/image.jpg");
// Generate a new GRPC compatible Input object from buffer
const imageInput = Input.getInputFromBytes({
inputId: "demo",
imageBytes: imageBuffer,
});
// The input can now be used as an input for a model prediction methods
const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
modelId: "multimodal-clip-embed",
});
const prediction = await model.predict({
inputs: [imageInput],
});
console.log(prediction);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioBytes? | null | Uint8Array | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageBytes? | null | Uint8Array | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textBytes? | null | Uint8Array | null |
› videoBytes? | null | Uint8Array | null |
Returns
Input
An Input object for the specified input ID.
Defined in
getInputFromFile
▸ getInputFromFile(«destructured»): Input
Create input proto from files.
Example
import { Input, Model } from "clarifai-nodejs";
import path from "path";
// Generate a new GRPC compatible Input object from buffer
const imageInput = Input.getInputFromFile({
inputId: "demo",
imageFile: path.resolve(__dirname, "path/to/image.jpg"),
});
// The input can now be used as an input for a model prediction methods
const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
modelId: "multimodal-clip-embed",
});
const prediction = await model.predict({
inputs: [imageInput],
});
console.log(prediction);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioFile? | null | string | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageFile? | null | string | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textFile? | null | string | null |
› videoFile? | null | string | null |
Returns
Input
- An Input object for the specified input ID.
Defined in
getInputFromUrl
▸ getInputFromUrl(«destructured»): Input
Upload input from URL.
Example
import { Input, Model } from "clarifai-nodejs";
// Generate a new GRPC compatible Input object from buffer
const imageInput = Input.getInputFromUrl({
inputId: "demo",
imageUrl: "https://samples.clarifai.com/dog2.jpeg",
});
// The input can now be used as an input for a model prediction methods
const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
modelId: "multimodal-clip-embed",
});
const prediction = await model.predict({
inputs: [imageInput],
});
console.log(prediction);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioUrl? | null | string | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imageUrl? | null | string | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textUrl? | null | string | null |
› videoUrl? | null | string | null |
Returns
Input
- Job ID for the upload request.
Defined in
getInputsFromCsv
▸ getInputsFromCsv(«destructured»): Promise<Input[]>
Create Input proto from CSV File. Supported columns are: 'inputid', 'input', 'concepts', 'metadata', 'geopoints'
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› csvPath | string | undefined |
› csvType | "url" | "raw" | "file" | "raw" |
› datasetId? | null | string | null |
› inputType | "image" | "text" | "video" | "audio" | "text" |
› labels | boolean | true |
Returns
Promise<Input[]>
- An array of Input objects for the specified input ID.
Defined in
getMaskProto
▸ getMaskProto(«destructured»): Annotation
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inputId | string |
› label | string |
› polygons | Polygon[] |
Returns
Annotation
Defined in
getMultimodalInput
▸ getMultimodalInput(«destructured»): Input
Create input proto for text and image from bytes or url
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› datasetId? | null | string | null |
› imageBytes? | null | Uint8Array | null |
› imageUrl? | null | string | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› rawText? | null | string | null |
› textBytes? | null | Uint8Array | null |
Returns
Input
- An Input object for the specified input ID.
Defined in
getProto
▸ getProto(«destructured»): Input
Create input proto for image data type.
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› audioPb? | null | { base64: string } | null |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› imagePb? | null | { base64: string ; url?: undefined } | { base64?: undefined ; url: string } | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› textPb? | null | { raw: string } | null |
› videoPb? | null | { base64: string } | null |
Returns
Input
- An Input object for the specified input ID.
Defined in
getTextInput
▸ getTextInput(«destructured»): Input
Create input proto for text data type from raw text.
Example
import { Input, Model } from "clarifai-nodejs";
// Generate a new GRPC compatible Input object from buffer
const textInput = Input.getTextInput({
inputId: "demo",
rawText: "Sample text for input generation",
});
// The input can now be used as an input for a model prediction methods
const model = new Model({
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
modelId: "multimodal-clip-embed",
});
const prediction = await model.predict({
inputs: [textInput],
});
console.log(prediction);
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› datasetId? | null | string | null |
› geoInfo? | null | AsObject | null |
› inputId | string | undefined |
› labels? | null | string[] | null |
› metadata? | null | Record<string, JavaScriptValue> | null |
› rawText | string | undefined |
Returns
Input
- An Input object for the specified input ID.
Defined in
getTextInputsFromFolder
▸ getTextInputsFromFolder(«destructured»): Input[]
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› datasetId | null | string | null |
› folderPath | string | undefined |
› labels | boolean | false |
Returns
Input[]
Defined in
Model
Model is a class that provides access to Clarifai API endpoints related to Model information.
This is its hierarchy:
-
Lister↳
Model
Constructor
• new Model(config): Model
Initializes a Model object.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
Parameters
| Name | Type |
|---|---|
config | ModelConfig |
Returns
Model
Overrides
Lister.constructor
Defined in
Properties
appId
• Private appId: string
Defined in
id
• Private id: string
Defined in
modelInfo
• modelInfo: Model
Defined in
modelUserAppId
• Private modelUserAppId: undefined | UserAppIDSet
Defined in
modelVersion
• Private modelVersion: undefined | { id: string }
Defined in
runner
• Private runner: undefined | RunnerSelector
Defined in
trainingParams
• Private trainingParams: Record<string, unknown>
Defined in
Methods
availableMethods
▸ availableMethods(): Promise<string[]>
Returns
Promise<string[]>
Defined in
constructRequestWithMethodSignature
▸ constructRequestWithMethodSignature(request, config): Promise<PostModelOutputsRequest>
Parameters
| Name | Type |
|---|---|
request | PostModelOutputsRequest |
config | TextModelPredictConfig |
Returns
Promise<PostModelOutputsRequest>
Defined in
createVersion
▸ createVersion(modelVersion): Promise<undefined | AsObject>
Creates a model version for the Model.
Example
import { Model } from "clarifai-nodejs";
import {
ModelVersion,
OutputInfo,
} from "clarifai-nodejs-grpc/proto/clarifai/api/resources_pb";
import { Struct } from "google-protobuf/google/protobuf/struct_pb.js";
export const model = new Model({
modelId: "margin-100-image-cropper",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
// Creating a GRPC compatible outputInfo object with custom margin parameters
const outputInfo = new OutputInfo().setParams(
Struct.fromJavaScript({ margin: 1.5 }),
);
// GRPC compatible ModelVersion object with previously created output info config
const modelVersion = new ModelVersion()
.setDescription("Setting output info margin parameters to 1.5")
.setOutputInfo(outputInfo);
// Creating a new version of the model with previously created output info config
const modelObjectWithVersion = await model.createVersion(modelVersion);
console.log(modelObjectWithVersion);
Parameters
| Name | Type |
|---|---|
modelVersion | ModelVersion |
Returns
Promise<undefined | AsObject>
Defined in
deleteVersion
▸ deleteVersion(versionId): Promise<void>
Deletes a model version for the Model.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
model.deleteVersion("version_id");
Parameters
| Name | Type | Description |
|---|---|---|
versionId | string | The version ID to delete. |
Returns
Promise<void>
Defined in
generate
▸ generate(«destructured»): AsyncGenerator<AsObject[], any, unknown>
Parameters
| Name | Type |
|---|---|
«destructured» | TextModelPredictConfig |
Returns
AsyncGenerator<AsObject[], any, unknown>
Defined in
generateGrpc
▸ generateGrpc(«destructured»): AsyncGenerator<AsObject | ["deploying", AsObject], any, unknown>
Parameters
| Name | Type |
|---|---|
«destructured» | TextModelPredictConfig |
Returns
AsyncGenerator<AsObject | ["deploying", AsObject], any, unknown>
Defined in
getParamInfo
▸ getParamInfo(param): Promise<Record<string, any>>
Returns the param info for the model.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
model.getParamInfo("template");
Parameters
| Name | Type |
|---|---|
param | string |
Returns
Promise<Record<string, any>>
Defined in
getParams
▸ getParams(template?, saveTo?): Promise<Record<string, any>>
Returns the model params for the model type as object & also writes to a yaml file
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const modelParams = await model.getParams("face-detection", "params.yml");
console.log(modelParams);
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
template | null | string | null | The training template to use for the model type. |
saveTo | string | "params.yaml" | The file path to save the yaml file. |
Returns
Promise<Record<string, any>>
- A promise that resolves to the model params for the model type.
Defined in
getRunner
▸ getRunner(): undefined | AsObject
Returns the runner for the model.
Returns
undefined | AsObject
- The runner for the model.
Defined in
listTrainingTemplates
▸ listTrainingTemplates(): Promise<string[]>
Lists all the training templates for the model type.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const trainingTemplates = await model.listTrainingTemplates();
console.log(trainingTemplates);
Returns
Promise<string[]>
- A promise that resolves to a list of training templates for the model type.
Defined in
listVersions
▸ listVersions(«destructured»?): AsyncGenerator<AsObject[], void, void>
Lists all the versions for the model.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "lvm-dummy-test",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const versions = await model.listVersions().next();
console.log(versions);
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› pageNo? | number |
› perPage? | number |
Returns
AsyncGenerator<AsObject[], void, void>
Notes
Defaults to 16 per page if pageNo is not specified
Defined in
loadInfo
▸ loadInfo(): Promise<void>
Loads the current model info. Usually called internally by other methods, to ensure the model info is loaded with latest data.
Returns
Promise<void>
Defined in
methodSignatures
▸ methodSignatures(): Promise<AsObject[]>
Returns
Promise<AsObject[]>
Defined in
overrideModelVersion
▸ overrideModelVersion(«destructured»): void
Overrides the model version.
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inferenceParams? | Record<string, JavaScriptValue> |
› outputConfig? | OutputConfig |
Returns
void
Defined in
predict
▸ predict(predictArgs): Promise<AsObject[]>
Predicts the model based on the given inputs. Useful for chat / text based llms
Parameters
| Name | Type |
|---|---|
predictArgs | TextModelPredictConfig |
Returns
Promise<AsObject[]>
Defined in
▸ predict(«destructured»): Promise<AsObject[]>
Predicts the model based on the given inputs.
Use the Input module to create the input objects.
Example
import { Model, Input } from "clarifai-nodejs";
export const model = new Model({
modelId: "multimodal-clip-embed",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
const input = Input.getInputFromBytes({
inputId: "intro-text",
textBytes: Buffer.from("Hi my name is Jim."),
});
const textPrediction = await model.predict({
inputs: [input],
});
console.log(textPrediction);
const imageInput = Input.getInputFromUrl({
inputId: "test-image",
imageUrl:
"https://goldenglobes.com/wp-content/uploads/2023/10/17-tomcruiseag.jpg",
});
const imagePrediction = await model.predict({
inputs: [imageInput],
});
console.log(imagePrediction);
Parameters
| Name | Type |
|---|---|
«destructured» | GeneralModelPredictConfig |
Returns
Promise<AsObject[]>
- A promise that resolves to the model prediction.
Defined in
predictByBytes
▸ predictByBytes(«destructured»): Promise<AsObject[]>
Predicts the model based on the given inputs. Inputs can be provided as a Buffer.
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inferenceParams? | Record<string, JavaScriptValue> |
› inputBytes | Buffer |
› inputType | "image" | "text" | "video" | "audio" |
› outputConfig? | OutputConfig |
Returns
Promise<AsObject[]>
- A promise that resolves to the model prediction.
Defined in
predictByFilepath
▸ predictByFilepath(«destructured»): Promise<AsObject[]>
Predicts the model based on the given inputs. Inputs can be provided as a filepath which can be read.
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› filepath | string |
› inferenceParams? | Record<string, JavaScriptValue> |
› inputType | "image" | "text" | "video" | "audio" |
› outputConfig? | OutputConfig |
Returns
Promise<AsObject[]>
- A promise that resolves to the model prediction.
Defined in
predictByUrl
▸ predictByUrl(«destructured»): Promise<AsObject[]>
Predicts the model based on the given inputs. Inputs can be provided as a URL.
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› inferenceParams? | Record<string, JavaScriptValue> |
› inputType | "image" | "text" | "video" | "audio" |
› outputConfig? | OutputConfig |
› url | string |
Returns
Promise<AsObject[]>
- A promise that resolves to the model prediction.
Defined in
setRunner
▸ setRunner(runner): void
Sets the runner for the model.
Parameters
| Name | Type |
|---|---|
runner | Subset<AsObject> |
Returns
void
Defined in
stream
▸ stream(config): Promise<{ end: () => void ; iterator: AsyncGenerator<AsObject[], any, unknown> ; send: (request: PostModelOutputsRequest) => void }>
Parameters
| Name | Type |
|---|---|
config | TextModelPredictConfig |
Returns
Promise<{ end: () => void ; iterator: AsyncGenerator<AsObject[], any, unknown> ; send: (request: PostModelOutputsRequest) => void }>
Defined in
streamWithControl
▸ streamWithControl(«destructured»): Object
Parameters
| Name | Type |
|---|---|
«destructured» | TextModelPredictConfig |
Returns
Object
| Name | Type |
|---|---|
end | () => void |
iterator | AsyncGenerator<AsObject | ["deploying", AsObject], any, unknown> |
send | (request: PostModelOutputsRequest) => void |
Defined in
updateParams
▸ updateParams(modelParams): void
Updates the model params for the model.
Example
import { Model } from "clarifai-nodejs";
export const model = new Model({
modelId: "face-detection",
authConfig: {
pat: process.env.CLARIFAI_PAT!,
userId: process.env.CLARIFAI_USER_ID!,
appId: process.env.CLARIFAI_APP_ID!,
},
});
model.updateParams({
batchSize: 8,
datasetVersion: "version_id",
});
Parameters
| Name | Type | Description |
|---|---|---|
modelParams | Record<string, unknown> | The model params to update. |
Returns
void
Defined in
getOutputDataFromModelResponse
▸ getOutputDataFromModelResponse(outputs): undefined | AsObject
Parameters
| Name | Type |
|---|---|
outputs | AsObject[] |
Returns
undefined | AsObject
Defined in
RAG
RAG is a class that provides access to Clarifai API endpoints related to RAG information.
Constructor
• new RAG(«destructured»): RAG
Parameters
| Name | Type |
|---|---|
«destructured» | RAGConfig |
Returns
RAG
Defined in
Properties
app
• app: App
Defined in
authConfig
• Private authConfig: AuthConfig
Defined in
promptWorkflow
• promptWorkflow: Workflow
Defined in
Methods
chat
▸ chat(«destructured»): Promise<Message[]>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› clientManageState? | boolean | true |
› messages | Message[] | undefined |
Returns
Promise<Message[]>
Defined in
upload
▸ upload(«destructured»): Promise<void>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› batchSize? | number | 128 |
› chunkOverlap? | number | 200 |
› chunkSize? | number | 1024 |
› datasetId? | string | undefined |
› filePath? | string | undefined |
› folderPath? | string | undefined |
› metadata? | Record<string, JavaScriptValue> | undefined |
› url? | string | undefined |
Returns
Promise<void>
Defined in
validateInputs
▸ validateInputs(workflowUrl?, workflow?, authConfig?): void
Parameters
| Name | Type |
|---|---|
workflowUrl? | string |
workflow? | Workflow |
authConfig? | AuthConfig | UrlAuthConfig |
Returns
void
Defined in
setup
▸ setup(«destructured»): Promise<RAG>
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› appUrl? | $\{string}://$\{string}/$\{string}/$\{string}\ | undefined |
› authConfig? | AuthAppConfig | Omit<AuthConfig, "appId"> & { appId?: undefined } | undefined |
› baseWorkflow? | string | "Text" |
› llmUrl? | ClarifaiUrl | mistral-7B-Instruct |
› maxResults? | number | 5 |
› minScore? | number | 0.95 |
› promptTemplate? | string | DEFAULT_RAG_PROMPT_TEMPLATE |
› workflowId? | string | undefined |
› workflowYamlFilename? | string | "prompter_wf.yaml" |
Returns
Promise<RAG>
Defined in
Search
Search is a class that provides access to Clarifai API endpoints related to Search information.
This is its hierarchy:
-
Lister↳
Search
Constructor
• new Search(«destructured»): Search
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› algorithm? | SupportedAlgorithm | DEFAULT_SEARCH_ALGORITHM |
› authConfig? | AuthConfig | undefined |
› metric? | SupportedMetric | DEFAULT_SEARCH_METRIC |
› topK? | number | DEFAULT_TOP_K |
Returns
Search
Overrides
Lister.constructor
Defined in
Properties
algorithm
• Private algorithm: SupportedAlgorithm
Defined in
dataProto
• Private dataProto: Data
Defined in
inputProto
• Private inputProto: Input
Defined in
metricDistance
• Private metricDistance: "COSINE_DISTANCE" | "EUCLIDEAN_DISTANCE"
Defined in
topK
• Private topK: number
Defined in
Methods
getAnnotProto
▸ getAnnotProto(args): Annotation
Parameters
| Name | Type |
|---|---|
args | Object |
args.concepts? | { id?: string ; language?: string ; name?: string ; value?: number }[] |
args.geoPoint? | Object |
args.geoPoint.geoLimit | number |
args.geoPoint.latitude | number |
args.geoPoint.longitude | number |
args.imageBytes? | unknown |
args.imageUrl? | string |
args.inputDatasetIds? | string[] |
args.inputStatusCode? | number |
args.inputTypes? | ("image" | "text" | "video" | "audio")[] |
args.metadata? | Record<string, unknown> |
args.textRaw? | string |
Returns
Annotation
Defined in
getGeoPointProto
▸ getGeoPointProto(longitude, latitude, geoLimit): Geo
Parameters
| Name | Type |
|---|---|
longitude | number |
latitude | number |
geoLimit | number |
Returns
Geo
Defined in
getInputProto
▸ getInputProto(args): Input
Parameters
| Name | Type |
|---|---|
args | Object |
args.concepts? | { id?: string ; language?: string ; name?: string ; value?: number }[] |
args.geoPoint? | Object |
args.geoPoint.geoLimit | number |
args.geoPoint.latitude | number |
args.geoPoint.longitude | number |
args.imageBytes? | unknown |
args.imageUrl? | string |
args.inputDatasetIds? | string[] |
args.inputStatusCode? | number |
args.inputTypes? | ("image" | "text" | "video" | "audio")[] |
args.metadata? | Record<string, unknown> |
args.textRaw? | string |
Returns
Input
Defined in
listAllPagesGenerator
▸ listAllPagesGenerator<T>(«destructured»): AsyncGenerator<AsObject, void, void>
Type parameters
| Name | Type |
|---|---|
T | extends PostAnnotationsSearchesRequest | PostInputsSearchesRequest |
Parameters
| Name | Type | Default value |
|---|---|---|
«destructured» | Object | undefined |
› endpoint | (request: T, metadata: Metadata, options: Partial<CallOptions>) => Promise<MultiSearchResponse> | undefined |
› page? | number | 1 |
› perPage? | number | undefined |
› requestData | T | undefined |
Returns
AsyncGenerator<AsObject, void, void>
Defined in
query
▸ query(«destructured»): AsyncGenerator<AsObject, void, void>
Parameters
| Name | Type |
|---|---|
«destructured» | Object |
› filters? | { concepts?: { id?: string ; language?: string ; name?: string ; value?: number }[] ; geoPoint?: { geoLimit: number ; latitude: number ; longitude: number } ; imageBytes?: unknown ; imageUrl?: string ; inputDatasetIds?: string[] ; inputStatusCode?: number ; inputTypes?: ("image" | "text" | "video" | "audio")[] ; metadata?: Record<string, unknown> ; textRaw?: string }[] |
› page? | number |
› perPage? | number |
› ranks? | { concepts?: { id?: string ; language?: string ; name?: string ; value?: number }[] ; geoPoint?: { geoLimit: number ; latitude: number ; longitude: number } ; imageBytes?: unknown ; imageUrl?: string ; inputDatasetIds?: string[] ; inputStatusCode?: number ; inputTypes?: ("image" | "text" | "video" | "audio")[] ; metadata?: Record<string, unknown> ; textRaw?: string }[] |
Returns
AsyncGenerator<AsObject, void, void>
Defined in
User
User is a class that provides access to Clarifai API endpoints related to user information.
This is its hierarchy:
-
Lister↳
User