forked from replicate/replicate-javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.js
More file actions
47 lines (44 loc) · 1.44 KB
/
models.js
File metadata and controls
47 lines (44 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Get information about a model
*
* @param {string} model_owner - Required. The name of the user or organization that owns the model
* @param {string} model_name - Required. The name of the model
* @returns {Promise<object>} Resolves with the model data
*/
async function getModel(model_owner, model_name) {
return this.request(`/models/${model_owner}/${model_name}`, {
method: 'GET',
});
}
/**
* List model versions
*
* @param {string} model_owner - Required. The name of the user or organization that owns the model
* @param {string} model_name - Required. The name of the model
* @returns {Promise<object>} Resolves with the list of model versions
*/
async function listModelVersions(model_owner, model_name) {
return this.request(`/models/${model_owner}/${model_name}/versions`, {
method: 'GET',
});
}
/**
* Get a specific model version
*
* @param {string} model_owner - Required. The name of the user or organization that owns the model
* @param {string} model_name - Required. The name of the model
* @param {string} version_id - Required. The model version
* @returns {Promise<object>} Resolves with the model version data
*/
async function getModelVersion(model_owner, model_name, version_id) {
return this.request(
`/models/${model_owner}/${model_name}/versions/${version_id}`,
{
method: 'GET',
}
);
}
module.exports = {
get: getModel,
versions: { list: listModelVersions, get: getModelVersion },
};