Skip to content

Commit 4ff031d

Browse files
Stainless Botstainless-app[bot]
authored andcommitted
feat(api): update via SDK Studio (#220)
1 parent 0b5d27c commit 4ff031d

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ const client = new PromptFoundry({
149149
});
150150

151151
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+
);
153155
}
154156

155157
main();
@@ -166,7 +168,7 @@ a subclass of `APIError` will be thrown:
166168
<!-- prettier-ignore -->
167169
```ts
168170
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) => {
170172
if (err instanceof PromptFoundry.APIError) {
171173
console.log(err.status); // 400
172174
console.log(err.name); // BadRequestError
@@ -209,7 +211,7 @@ const client = new PromptFoundry({
209211
});
210212

211213
// Or, configure per-request:
212-
await client.prompts.getParameters('1212121', {
214+
await client.completion.create('1212121', {
213215
maxRetries: 5,
214216
});
215217
```
@@ -226,7 +228,7 @@ const client = new PromptFoundry({
226228
});
227229

228230
// Override per-request:
229-
await client.prompts.getParameters('1212121', {
231+
await client.completion.create('1212121', {
230232
timeout: 5 * 1000,
231233
});
232234
```
@@ -247,13 +249,15 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi
247249
```ts
248250
const client = new PromptFoundry();
249251

250-
const response = await client.prompts.getParameters('1212121').asResponse();
252+
const response = await client.completion.create('1212121').asResponse();
251253
console.log(response.headers.get('X-My-Header'));
252254
console.log(response.statusText); // access the underlying Response object
253255

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();
255259
console.log(raw.headers.get('X-My-Header'));
256-
console.log(modelParameters);
260+
console.log(completionCreateResponse.message);
257261
```
258262

259263
### Making custom/undocumented requests
@@ -357,7 +361,7 @@ const client = new PromptFoundry({
357361
});
358362

359363
// Override per-request:
360-
await client.prompts.getParameters('1212121', {
364+
await client.completion.create('1212121', {
361365
httpAgent: new http.Agent({ keepAlive: false }),
362366
});
363367
```

scripts/build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ npm exec tsc-multi
3232
# copy over handwritten .js/.mjs/.d.ts files
3333
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
3434
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
35-
# we need to add exports = module.exports = Prompt Foundry Node to index.js;
35+
# we need to add exports = module.exports = Prompt Foundry TypeScript SDK to index.js;
3636
# No way to get that from index.ts because it would cause compile errors
3737
# when building .mjs
3838
node scripts/utils/fix-index-exports.cjs

0 commit comments

Comments
 (0)