You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Use <a href=https://yarnpkg.com/ style="text-decoration:none">yarn</a> to package and install the SDK. </p>
89
-
++++
60
+
Use https://yarnpkg.com/[yarn] to package and install the SDK:
61
+
62
+
Globally:
63
+
64
+
- `$ yarn global add ./sdk-javascript`
65
+
66
+
In an existing project (directly from github):
67
+
68
+
- `$ yarn add modzy/sdk-javascript`
69
+
90
70
91
-
- `$ yarn add ./sdk-javascript`
71
+
Or you can use https://nodejs.org/[npm]:
92
72
93
-
//no reference to node.js in here but it is in contributing.
73
+
Globally
94
74
95
-
== Usage
75
+
- `$ npm install -g ./sdk-javascript`
96
76
77
+
In an existing project (directly from github):
97
78
98
-
=== Initialize
79
+
- `$ npm install modzy/sdk-javascript`
99
80
100
-
Once you have a `model` and `version` identified, authenticate to Modzy with your API key:
81
+
== Initialize
82
+
83
+
Once you have a `model` and `version` identified, get authenticated with your API key.
84
+
85
+
API keys are security credentials required to perform API requests to Modzy. Our API keys are composed of an ID that is split by a dot into two parts: the prefix and the body. +
86
+
The *prefix* is the API keys' visible part. It’s only used to identify the key and by itself, it’s unable to perform API requests.
87
+
88
+
link:https://models.modzy.com/docs/users-keys/api-keys/retrieve-users-api-keys[List your API keys]:
The *body* is the prefix’s complement and it’s required to perform API requests. Since it’s not stored on Modzy’s servers, it cannot be recovered. Make sure to save it securely. If lost, you can link:https://models.modzy.com/docs/users-keys/api-keys/replace-API-key[replace the API key's body].
101
+
102
+
link:https://models.modzy.com/docs/users-keys/api-keys/retrieve-full-API-key[Retrieve the API key's body]:
Modzy’s Marketplace includes pre-trained and re-trainable AI models from industry-leading machine learning companies, accelerating the process from data to value.
122
134
123
-
<br>
124
-
++++
135
+
The Model service drives the Marketplace and can be integrated with other applications, scripts, and systems. It provides routes to list, search, and filter model and model-version details.
Models accept specific *input file link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types[MIME] types*. Some models may require multiple input file types to run data accordingly. In this sample, we use a model that requires `text/plain`.
178
+
179
+
Models require inputs to have a specific *input name* declared in the job request. This name can be found in the model’s details. In this sample, we use a model that requires `input.txt`.
180
+
181
+
Additionally, users can set their own input names. When multiple input items are processed in a job, these names are helpful to identify and get each input’s results. In this sample, we use a model that requires `input-1` and `input-2`.
182
+
183
+
link:https://models.modzy.com/docs/marketplace/models/retrieve-model-details[Get a model's details]:
Model specific sample requests are available in the version details and in the Model Details page.
192
+
193
+
link:https://models.modzy.com/docs/marketplace/versions/retrieve-version-details[Get version details]:
194
+
195
+
[source, js]
196
+
----
197
+
let modelVersion = await modzyClient.getModelVersion("ed542963de", "0.0.27");
198
+
console.log("inputs:");
199
+
for(key in modelVersion.inputs){
200
+
let input = modelVersion.inputs[key];
201
+
console.log(` key ${input.name}, type ${input.acceptedMediaTypes}, description: ${input.description}`);
202
+
}
203
+
console.log("outputs:");
204
+
for(key in modelVersion.outputs){
205
+
let output = modelVersion.outputs[key];
206
+
console.log(` key ${output.name}, type ${output.mediaType}, description: ${output.description}`);
207
+
}
208
+
----
209
+
210
+
=== Submit a job and get results
211
+
212
+
A *job* is the process that sends data to a model, sets the model to run the data, and returns results.
213
+
214
+
Modzy supports several *input types* such as `text`, `embedded` for Base64 strings, `aws-s3` and `aws-s3-folder` for inputs hosted in buckets, and `jdbc` for inputs stored in databases. In this sample, we use `text`.
215
+
216
+
link:https://github.com/modzy/sdk-javascript/blob/readmeUpdates/samples.adoc[Here] are samples to submit jobs with `embedded`, `aws-s3`, `aws-s3-folder`, and `jdbc` input types.
150
217
151
-
Submit a job providing the model, version, and input file:
218
+
link:https://models.modzy.com/docs/jobs/jobs/submit-job-text[Submit a job with the model, version, and input items]:
152
219
153
220
[source, js]
154
221
----
@@ -162,15 +229,18 @@ let job = await modzyClient.submitJobText(
162
229
);
163
230
----
164
231
165
-
Hold until the inference is complete and results become available:
232
+
link:https://models.modzy.com/docs/jobs/jobs/retrieve-job-details[Hold until the inference is complete and results become available]:
166
233
167
234
[source, js]
168
235
----
169
236
job = await modzyClient.blockUntilComplete(job);
170
-
171
237
----
172
238
173
-
Get the output results:
239
+
link:https://models.modzy.com/docs/jobs/results/retrieve-results[Get the results]:
240
+
241
+
Results are available per input item and can be identified with the name provided for each input item upon job request. You can also add an input name to the route and limit the results to any given input item.
242
+
243
+
Jobs requested for multiple input items may have partial results available prior to job completion.
174
244
175
245
[source, js]
176
246
----
@@ -202,7 +272,11 @@ catch(error){
202
272
203
273
== Features
204
274
205
-
Currently we support the following api routes:
275
+
Modzy supports link:https://models.modzy.com/docs/features/batch-processing[batch processing], link:https://models.modzy.com/docs/features/explainability[explainability], and link:https://models.modzy.com/docs/features/model-drift[model drift detection].
276
+
277
+
== APIs
278
+
279
+
Here is a list of Modzy APIs. To see all the APIs, check our link:https://models.modzy.com/docs/home/home[Documentation].
0 commit comments