@@ -29,6 +29,7 @@ const client = new Kernel({
2929
3030async function main () {
3131 const response = await client .apps .deploy ({
32+ entrypointRelPath: ' app.py' ,
3233 file: fs .createReadStream (' path/to/file' ),
3334 version: ' REPLACE_ME' ,
3435 });
@@ -53,7 +54,11 @@ const client = new Kernel({
5354});
5455
5556async function main() {
56- const params: Kernel .AppDeployParams = { file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' };
57+ const params: Kernel .AppDeployParams = {
58+ entrypointRelPath: ' app.py' ,
59+ file: fs .createReadStream (' path/to/file' ),
60+ version: ' REPLACE_ME' ,
61+ };
5762 const response: Kernel .AppDeployResponse = await client .apps .deploy (params );
5863}
5964
@@ -78,17 +83,23 @@ import Kernel, { toFile } from '@onkernel/sdk';
7883const client = new Kernel ();
7984
8085// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
81- await client .apps .deploy ({ file: fs .createReadStream (' /path/to/file' ) });
86+ await client .apps .deploy ({ entrypointRelPath: ' app.py ' , file: fs .createReadStream (' /path/to/file' ) });
8287
8388// Or if you have the web `File` API you can pass a `File` instance:
84- await client .apps .deploy ({ file: new File ([' my bytes' ], ' file' ) });
89+ await client .apps .deploy ({ entrypointRelPath: ' app.py ' , file: new File ([' my bytes' ], ' file' ) });
8590
8691// You can also pass a `fetch` `Response`:
87- await client .apps .deploy ({ file: await fetch (' https://somesite/file' ) });
92+ await client .apps .deploy ({ entrypointRelPath: ' app.py ' , file: await fetch (' https://somesite/file' ) });
8893
8994// Finally, if none of the above are convenient, you can use our `toFile` helper:
90- await client .apps .deploy ({ file: await toFile (Buffer .from (' my bytes' ), ' file' ) });
91- await client .apps .deploy ({ file: await toFile (new Uint8Array ([0 , 1 , 2 ]), ' file' ) });
95+ await client .apps .deploy ({
96+ entrypointRelPath: ' app.py' ,
97+ file: await toFile (Buffer .from (' my bytes' ), ' file' ),
98+ });
99+ await client .apps .deploy ({
100+ entrypointRelPath: ' app.py' ,
101+ file: await toFile (new Uint8Array ([0 , 1 , 2 ]), ' file' ),
102+ });
92103```
93104
94105## Handling errors
@@ -101,7 +112,7 @@ a subclass of `APIError` will be thrown:
101112``` ts
102113async function main() {
103114 const response = await client .apps
104- .deploy ({ file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
115+ .deploy ({ entrypointRelPath: ' app.py ' , file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
105116 .catch (async (err ) => {
106117 if (err instanceof Kernel .APIError ) {
107118 console .log (err .status ); // 400
@@ -145,7 +156,7 @@ const client = new Kernel({
145156});
146157
147158// Or, configure per-request:
148- await client .apps .deploy ({ file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' }, {
159+ await client .apps .deploy ({ entrypointRelPath : ' app.py ' , file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' }, {
149160 maxRetries: 5 ,
150161});
151162```
@@ -162,7 +173,7 @@ const client = new Kernel({
162173});
163174
164175// Override per-request:
165- await client .apps .deploy ({ file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' }, {
176+ await client .apps .deploy ({ entrypointRelPath: ' app.py ' , file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' }, {
166177 timeout: 5 * 1000 ,
167178});
168179```
@@ -186,13 +197,13 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
186197const client = new Kernel ();
187198
188199const response = await client .apps
189- .deploy ({ file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
200+ .deploy ({ entrypointRelPath: ' app.py ' , file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
190201 .asResponse ();
191202console .log (response .headers .get (' X-My-Header' ));
192203console .log (response .statusText ); // access the underlying Response object
193204
194205const { data : response, response : raw } = await client .apps
195- .deploy ({ file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
206+ .deploy ({ entrypointRelPath: ' app.py ' , file: fs .createReadStream (' path/to/file' ), version: ' REPLACE_ME' })
196207 .withResponse ();
197208console .log (raw .headers .get (' X-My-Header' ));
198209console .log (response .apps );
0 commit comments