Skip to content

Commit b8af385

Browse files
authored
Merge pull request #19 from modzy/feat/docs_update
feat: docs review
2 parents 95f5f52 + b9d96a6 commit b8af385

File tree

4 files changed

+30
-20
lines changed

4 files changed

+30
-20
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@modzy/modzy-sdk",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Javascript SDK for Modzy",
55
"license": "Booz Allen Public License v1.0",
66
"main": "dist/main.js",

samples/job_with_file_input_sample.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async function createJobWithFileInput(){
7171
// If you send a correct input key, but some wrong values, the model fails to process the input.
7272
sources["wrong-value"] = {"input": configPath, "config.json":imagePath}
7373
// When you have all your inputs ready, you can use our helper method to submit the job as follows:
74-
let job = await modzyClient.submitJobFiles(model.modelId,modelVersion.version, sources);
74+
let job = await modzyClient.submitJobFile(model.modelId,modelVersion.version, sources);
7575
// Modzy creates the job and queue for processing. The job object contains all the info that you need to keep track
7676
// of the process, the most important being the job identifier and the job status.
7777
logger.info("job: "+job.jobIdentifier+" "+job.status);

src/job-client.js

+17-7
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,18 @@ class JobClient{
123123
* @param {string} modelId - the model id string
124124
* @param {versionId} versionId - version id string
125125
* @param {Object[]} textSources - The source(s) of the model
126+
* @param {boolean} explain - Explainability flag
126127
* @return {Object} the updated instance of the Job returned by Modzy API
127128
* @throws {ApiError} If there is something wrong with the service or the call
128129
*/
129-
submitJobText(modelId, versionId, textSources) {
130+
submitJobText(modelId, versionId, textSources, explain=false) {
130131
return this.submitJob(
131132
{
132133
"model": {
133134
"identifier": modelId,
134135
"version": versionId
135136
},
137+
"explain": explain,
136138
"input": {
137139
"type": "text",
138140
"sources": textSources
@@ -148,18 +150,20 @@ class JobClient{
148150
* @param {string} modelId - the model id string
149151
* @param {string} versionId - version id string
150152
* @param {Object[]} fileSources the source(s) of the model
153+
* @param {boolean} explain - Explainability flag
151154
* @return {Object} the updated instance of the Job returned by Modzy API
152155
* @throws {ApiError} if there is something wrong with the service or the call
153156
*/
154-
submitJobFiles(modelId, versionId, fileSources) {
157+
submitJobFile(modelId, versionId, fileSources, explain=false) {
155158
let job = {};
156159
let chunkSize = 1024*1024;
157160
return this.submitJob(
158161
{
159162
"model": {
160163
"identifier": modelId,
161164
"version": versionId
162-
}
165+
},
166+
"explain": explain
163167
}
164168
).then(
165169
(openJob)=>{
@@ -211,10 +215,11 @@ class JobClient{
211215
* @param {string} versionId - version id string
212216
* @param {string} mediaType - the media type of the embedded source
213217
* @param {Object[]} embeddedSources the source(s) of the model
218+
* @param {boolean} explain - Explainability flag
214219
* @return {Object} the updated instance of the Job returned by Modzy API
215220
* @throws {ApiError} if there is something wrong with the service or the call
216221
*/
217-
submitJobEmbedded(modelId, versionId, mediaType, embeddedSources) {
222+
submitJobEmbedded(modelId, versionId, mediaType, embeddedSources, explain=false) {
218223
let encodedSources = {};
219224
Object.keys(embeddedSources).forEach(
220225
sourceKey => {
@@ -237,6 +242,7 @@ class JobClient{
237242
"identifier": modelId,
238243
"version": versionId
239244
},
245+
"explain": explain,
240246
"input": {
241247
"type": "embedded",
242248
"sources": encodedSources
@@ -251,20 +257,22 @@ class JobClient{
251257
*
252258
* @param {string} modelId - the model id string
253259
* @param {string} versionId - version id string
254-
* @param {string} accessKeyID - access key of aws-s3
260+
* @param {string} accessKeyId - access key of aws-s3
255261
* @param {string} secretAccessKey - secret access key of aws-s3
256262
* @param {string} region - aws-s3 region
257263
* @param {Object[]} awss3Sources - the source(s) of the model
264+
* @param {boolean} explain - Explainability flag
258265
* @return {Object} the updated instance of the Job returned by Modzy API
259266
* @throws {ApiError} if there is something wrong with the service or the call
260267
*/
261-
submitJobAWSS3(modelId, versionId, accessKeyID, secretAccessKey, region, awss3Sources) {
268+
submitJobAWSS3(modelId, versionId, accessKeyId, secretAccessKey, region, awss3Sources, explain=false) {
262269
return this.submitJob(
263270
{
264271
"model": {
265272
"identifier": modelId,
266273
"version": versionId
267274
},
275+
"explain": explain,
268276
"input": {
269277
"type": "aws-s3",
270278
"accessKeyID": accessKeyID,
@@ -291,16 +299,18 @@ class JobClient{
291299
* @param {string} password - database password
292300
* @param {string} driver - fully qualified name of the driver class for jdbc
293301
* @param {string} query - the query to get the inputs of the model
302+
* @param {boolean} explain - Explainability flag
294303
* @return {Object} the updated instance of the Job returned by Modzy API
295304
* @throws {ApiError} if there is something wrong with the service or the call
296305
*/
297-
submitJobJDBC(modelId, versionId, url, username, password, driver, query) {
306+
submitJobJDBC(modelId, versionId, url, username, password, driver, query, explain=false) {
298307
return this.submitJob(
299308
{
300309
"model": {
301310
"identifier": modelId,
302311
"version": versionId
303312
},
313+
"explain": explain,
304314
"input": {
305315
"type": "jdbc",
306316
"url": url,

src/modzy-client.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -149,36 +149,36 @@ class ModzyClient {
149149
/**
150150
* @see {@link JobClient#submitJobText}
151151
*/
152-
submitJobText(modelId, versionId, textSources) {
153-
return this.jobClient.submitJobText(modelId, versionId, textSources);
152+
submitJobText(modelId, versionId, textSources, explain=false) {
153+
return this.jobClient.submitJobText(modelId, versionId, textSources, explain);
154154
}
155155

156156
/**
157157
* @see {@link JobClient#submitJobEmbedded}
158158
*/
159-
submitJobEmbedded(modelId, versionId, mediaType, embeddedSources) {
160-
return this.jobClient.submitJobEmbedded(modelId, versionId, mediaType, embeddedSources);
159+
submitJobEmbedded(modelId, versionId, mediaType, embeddedSources, explain=false) {
160+
return this.jobClient.submitJobEmbedded(modelId, versionId, mediaType, embeddedSources, explain);
161161
}
162162

163163
/**
164-
* @see {@link JobClient#submitJobEmbedded}
164+
* @see {@link JobClient#submitJobFile}
165165
*/
166-
submitJobFiles(modelId, versionId, fileSources) {
167-
return this.jobClient.submitJobFiles(modelId, versionId, fileSources);
166+
submitJobFile(modelId, versionId, fileSources, explain=false) {
167+
return this.jobClient.submitJobFile(modelId, versionId, fileSources, explain);
168168
}
169169

170170
/**
171171
* @see {@link JobClient#submitJobAWSS3}
172172
*/
173-
submitJobAWSS3(modelId, versionId, accessKeyID, secretAccessKey, region, awss3Sources) {
174-
return this.jobClient.submitJobAWSS3(modelId, versionId, accessKeyID, secretAccessKey, region, awss3Sources);
173+
submitJobAWSS3(modelId, versionId, accessKeyId, secretAccessKey, region, awss3Sources, explain=false) {
174+
return this.jobClient.submitJobAWSS3(modelId, versionId, accessKeyId, secretAccessKey, region, awss3Sources, explain);
175175
}
176176

177177
/**
178178
* @see {@link JobClient#submitJobJDBC}
179179
*/
180-
submitJobJDBC(modelId, versionId, url, username, password, driver, query) {
181-
return this.jobClient.submitJobJDBC(modelId, versionId, url, username, password, driver, query);
180+
submitJobJDBC(modelId, versionId, url, username, password, driver, query, explain=false) {
181+
return this.jobClient.submitJobJDBC(modelId, versionId, url, username, password, driver, query, explain);
182182
}
183183

184184
/**

0 commit comments

Comments
 (0)