Skip to content
This repository was archived by the owner on Aug 14, 2025. It is now read-only.

Commit 74b5549

Browse files
chore(docs): use top-level-await in example snippets
1 parent f0198eb commit 74b5549

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

README.md

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ const client = new LlamaStackClient({
2929
apiKey: process.env['LLAMA_STACK_CLIENT_API_KEY'], // This is the default and can be omitted
3030
});
3131

32-
async function main() {
33-
await client.datasetio.appendRows('REPLACE_ME', { rows: [{ foo: true }] });
34-
}
35-
36-
main();
32+
await client.datasetio.appendRows('REPLACE_ME', { rows: [{ foo: true }] });
3733
```
3834

3935
### Request & Response types
@@ -48,12 +44,8 @@ const client = new LlamaStackClient({
4844
apiKey: process.env['LLAMA_STACK_CLIENT_API_KEY'], // This is the default and can be omitted
4945
});
5046

51-
async function main() {
52-
const params: LlamaStackClient.DatasetioAppendRowsParams = { rows: [{ foo: true }] };
53-
await client.datasetio.appendRows('REPLACE_ME', params);
54-
}
55-
56-
main();
47+
const params: LlamaStackClient.DatasetioAppendRowsParams = { rows: [{ foo: true }] };
48+
await client.datasetio.appendRows('REPLACE_ME', params);
5749
```
5850

5951
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
@@ -66,21 +58,17 @@ a subclass of `APIError` will be thrown:
6658

6759
<!-- prettier-ignore -->
6860
```ts
69-
async function main() {
70-
const response = await client.datasetio
71-
.appendRows('REPLACE_ME', { rows: [{ foo: true }] })
72-
.catch(async (err) => {
73-
if (err instanceof LlamaStackClient.APIError) {
74-
console.log(err.status); // 400
75-
console.log(err.name); // BadRequestError
76-
console.log(err.headers); // {server: 'nginx', ...}
77-
} else {
78-
throw err;
79-
}
80-
});
81-
}
82-
83-
main();
61+
const response = await client.datasetio
62+
.appendRows('REPLACE_ME', { rows: [{ foo: true }] })
63+
.catch(async (err) => {
64+
if (err instanceof LlamaStackClient.APIError) {
65+
console.log(err.status); // 400
66+
console.log(err.name); // BadRequestError
67+
console.log(err.headers); // {server: 'nginx', ...}
68+
} else {
69+
throw err;
70+
}
71+
});
8472
```
8573

8674
Error codes are as follows:

0 commit comments

Comments
 (0)