@@ -57,13 +57,26 @@ Clone the repository:
5757
5858- `$ git clone https://github.com/modzy/sdk-javascript.git`
5959
60- ++++
61- <p>Use <a href=https://yarnpkg.com/ style="text-decoration:none">yarn</a> to package and install the SDK. </p>
62- ++++
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+
70+
71+ Or you can use https://nodejs.org/[npm]:
72+
73+ Globally
74+
75+ - `$ npm install -g ./sdk-javascript`
6376
64- - `$ yarn add ./sdk-javascript`
77+ In an existing project (directly from github):
6578
66- //no reference to node.js in here but it is in contributing.
79+ - `$ yarn install modzy/sdk-javascript`
6780
6881== Initialize
6982
@@ -76,6 +89,12 @@ link:https://models.modzy.com/docs/users-keys/api-keys/retrieve-users-api-keys[L
7689
7790[source, js]
7891----
92+ const keys = await modzyClient.getAccountingClient().getAPIKeys('your@email.com');
93+ keys.forEach(
94+ keys => {
95+ console.log(JSON.stringify(model));
96+ }
97+ );
7998----
8099
81100The *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].
@@ -84,6 +103,9 @@ link:https://models.modzy.com/docs/users-keys/api-keys/retrieve-full-API-key[Ret
84103
85104[source, js]
86105----
106+
107+ const hash = await modzyClient.getAccountingClient().getKeyBody('yourKey');
108+ console.log("The hash is: "+hash);
87109----
88110
89111Get authenticated with your API key:
@@ -116,15 +138,12 @@ link:https://models.modzy.com/docs/marketplace/models/retrieve-models[List model
116138
117139[source, js]
118140----
119- try{
120- const models = await modzyClient.getAllModels();
121- models.forEach(
122- model => {
123- console.log(JSON.stringify(model));
124- }
125- );
126- }
127-
141+ const models = await modzyClient.getAllModels();
142+ models.forEach(
143+ model => {
144+ console.log(JSON.stringify(model));
145+ }
146+ );
128147----
129148
130149Tags help categorize and filter models. They make model browsing easier.
@@ -133,14 +152,24 @@ link:https://models.modzy.com/docs/marketplace/tags/retrieve-tags[List tags]:
133152
134153[source, js]
135154----
136-
155+ const tags = await modzyClient.getAllTags();
156+ tags.forEach(
157+ tag => {
158+ console.log(JSON.stringify(tag));
159+ }
160+ );
137161----
138162
139163link:https://models.modzy.com/docs/marketplace/tags/retrieve-models-by-tags[List models by tag]:
140164
141165[source, js]
142166----
143-
167+ const tagsModels = await modzyClient.getTagsAndModels("language_and_text");
168+ tagsModels.models.forEach(
169+ model => {
170+ console.log(JSON.stringify(model));
171+ }
172+ );
144173----
145174
146175=== Get a model's details
@@ -165,7 +194,17 @@ link:https://models.modzy.com/docs/marketplace/versions/retrieve-version-details
165194
166195[source, js]
167196----
168-
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+ }
169208----
170209
171210=== Submit a job and get results
0 commit comments