@@ -149,7 +149,9 @@ const client = new PromptFoundry({
149
149
});
150
150
151
151
async function main() {
152
- const modelParameters: PromptFoundry .ModelParameters = await client .prompts .getParameters (' 1212121' );
152
+ const completionCreateResponse: PromptFoundry .CompletionCreateResponse = await client .completion .create (
153
+ ' 1212121' ,
154
+ );
153
155
}
154
156
155
157
main ();
@@ -166,7 +168,7 @@ a subclass of `APIError` will be thrown:
166
168
<!-- prettier-ignore -->
167
169
``` ts
168
170
async function main() {
169
- const modelParameters = await client .prompts . getParameters (' 1212121' ).catch (async (err ) => {
171
+ const completionCreateResponse = await client .completion . create (' 1212121' ).catch (async (err ) => {
170
172
if (err instanceof PromptFoundry .APIError ) {
171
173
console .log (err .status ); // 400
172
174
console .log (err .name ); // BadRequestError
@@ -209,7 +211,7 @@ const client = new PromptFoundry({
209
211
});
210
212
211
213
// Or, configure per-request:
212
- await client .prompts . getParameters (' 1212121' , {
214
+ await client .completion . create (' 1212121' , {
213
215
maxRetries: 5 ,
214
216
});
215
217
```
@@ -226,7 +228,7 @@ const client = new PromptFoundry({
226
228
});
227
229
228
230
// Override per-request:
229
- await client .prompts . getParameters (' 1212121' , {
231
+ await client .completion . create (' 1212121' , {
230
232
timeout: 5 * 1000 ,
231
233
});
232
234
```
@@ -247,13 +249,15 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
247
249
``` ts
248
250
const client = new PromptFoundry ();
249
251
250
- const response = await client .prompts . getParameters (' 1212121' ).asResponse ();
252
+ const response = await client .completion . create (' 1212121' ).asResponse ();
251
253
console .log (response .headers .get (' X-My-Header' ));
252
254
console .log (response .statusText ); // access the underlying Response object
253
255
254
- const { data : modelParameters, response : raw } = await client .prompts .getParameters (' 1212121' ).withResponse ();
256
+ const { data : completionCreateResponse, response : raw } = await client .completion
257
+ .create (' 1212121' )
258
+ .withResponse ();
255
259
console .log (raw .headers .get (' X-My-Header' ));
256
- console .log (modelParameters );
260
+ console .log (completionCreateResponse . message );
257
261
```
258
262
259
263
### Making custom/undocumented requests
@@ -357,7 +361,7 @@ const client = new PromptFoundry({
357
361
});
358
362
359
363
// Override per-request:
360
- await client .prompts . getParameters (' 1212121' , {
364
+ await client .completion . create (' 1212121' , {
361
365
httpAgent: new http .Agent ({ keepAlive: false }),
362
366
});
363
367
```
0 commit comments