runpod-sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/package.json +1 -1
- package/test/test.js +1 -10
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ JavaScript client sdk for runpod
|
|
|
6
6
|
|
|
7
7
|
```js
|
|
8
8
|
const { RUNPOD_API_KEY, ENDPOINT_ID } = process.env;
|
|
9
|
-
import runpodSdk from "
|
|
9
|
+
import runpodSdk from "runpod-sdk";
|
|
10
10
|
|
|
11
11
|
const runpod = runpodSdk(RUNPOD_API_KEY);
|
|
12
12
|
const endpoint = runpod.endpoint(ENDPOINT_ID);
|
|
13
|
-
const result = await endpoint.
|
|
13
|
+
const result = await endpoint.runSync({
|
|
14
14
|
input: {
|
|
15
15
|
prompt: "a photo of a horse the size of a Boeing 787",
|
|
16
16
|
},
|
|
@@ -37,10 +37,10 @@ const status = await endpoint.getStatus(requestId);
|
|
|
37
37
|
|
|
38
38
|
If the request has been completed, the status object returned will contain the `output` of the request.
|
|
39
39
|
|
|
40
|
-
If you don't want to manage polling for request completion yourself, you can simply call `
|
|
40
|
+
If you don't want to manage polling for request completion yourself, you can simply call `runSync`, which will enqueue the request and then poll in a loop (by default, once every 10 seconds) until the request completes, fails or times out.
|
|
41
41
|
|
|
42
42
|
```js
|
|
43
|
-
const result = await endpoint.
|
|
43
|
+
const result = await endpoint.runSync({
|
|
44
44
|
input: {
|
|
45
45
|
prompt: "a photo of a horse the size of a Boeing 787",
|
|
46
46
|
},
|
package/package.json
CHANGED
package/test/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import runpodSdk
|
|
1
|
+
import runpodSdk from "../dist/index.js"
|
|
2
2
|
|
|
3
3
|
const { RUNPOD_API_KEY, ENDPOINT_ID } = process.env
|
|
4
4
|
if (!(RUNPOD_API_KEY && ENDPOINT_ID)) {
|
|
@@ -39,12 +39,3 @@ console.log(await endpoint.getHealth())
|
|
|
39
39
|
console.log("runSync")
|
|
40
40
|
const result = await endpoint.runSync(request)
|
|
41
41
|
console.log(result)
|
|
42
|
-
//functional
|
|
43
|
-
// const run = runSync(RUNPOD_API_KEY, ENDPOINT_ID)
|
|
44
|
-
// const res = await run({
|
|
45
|
-
// input: {
|
|
46
|
-
// prompt: "a photo of a horse the size of a Boeing 787",
|
|
47
|
-
// },
|
|
48
|
-
// })
|
|
49
|
-
|
|
50
|
-
// console.log(res)
|