modzyClient.submitJobText

Submit a job using text as inputs

modzyClient.submitJobText(modelId, versionId, textSources, explain=false)

Submit a job based on plain text inputs, the sources dictionary is a double object structure as follows:

{
  '<<<<input-item-key>>>>': {
    '<<<<data-input-item-key>>>>: 'Text Content'
  }
}

Where:

<<<<input-item-key>>>>: are user defined keys to identify the input items.
<<<<data-input-item-key>>>>: are model defined keys (usually file names).

Parameters

ParameterTypeDescriptionExample
modelIdstringModel identifier provided by Modzy.'ed542963de'
versionIdstringThe model’s version number. It follows the semantic versioning format.'1.0.1'
textSourcesobjectA mapping of source names to text sources. Each source should be a mapping of model input key to a text string'{'my-input': {'input.txt': 'The text for the model'}}'
explainbooleanIf the model supports explainability, flag this job to return an explanation of the predictionstrue

Returns

A Job object with the status from the server

{
    "$schema": "http://json-schema.org/draft-06/schema#",
    "$ref": "#/definitions/Job",
    "definitions": {
        "Job": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "model": {
                    "$ref": "#/definitions/Model"
                },
                "status": {
                    "type": "string"
                },
                "totalInputs": {
                    "type": "integer"
                },
                "jobIdentifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "accessKey": {
                    "type": "string"
                },
                "explain": {
                    "type": "boolean"
                },
                "jobType": {
                    "type": "string"
                },
                "accountIdentifier": {
                    "type": "string"
                },
                "team": {
                    "$ref": "#/definitions/Team"
                },
                "user": {
                    "$ref": "#/definitions/User"
                },
                "jobInputs": {
                    "$ref": "#/definitions/JobInputs"
                },
                "submittedAt": {
                    "type": "string",
                    "format": "date-time"
                },
                "imageClassificationModel": {
                    "type": "boolean"
                }
            },
            "required": [
                "accessKey",
                "accountIdentifier",
                "explain",
                "imageClassificationModel",
                "jobIdentifier",
                "jobInputs",
                "jobType",
                "model",
                "status",
                "submittedAt",
                "team",
                "totalInputs",
                "user"
            ]            
        },
        "JobInputs": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "Model": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                }
            },
            "required": [
                "identifier",
                "name",
                "version"
            ]            
        },
        "Team": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string"
                }
            },
            "required": [
                "identifier"
            ]            
        },
        "User": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "identifier": {
                    "type": "string",
                    "format": "uuid"
                },
                "firstName": {
                    "type": "string"
                },
                "lastName": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                }
            },
            "required": [
                "email",
                "firstName",
                "identifier",
                "lastName"
            ]            
        }
    }
}

Examples

sources = {"my-input": {"input.txt": "Sometimes I really hate ribs"}}
job = await modzyClient.submitJobText('ed542963de', '0.0.27', sources);
console.log( `Job ${job.identifier} status ${job.status}` );

Using promises

sources = {"my-input": {"input.txt": "Sometimes I really hate ribs"}}
modzyClient.submitJobText('ed542963de', '0.0.27', sources)
  .then(
    (job)=>{
      console.log( `Job ${job.identifier} status ${job.status}` );
    }
  )
  .catch(
    (error)=>{
      console.error(error);
    }
  );