Skip to content

Commit 5ae7029

Browse files
committed
fix(examples): use top-level await for async functions
Replace unawaited function calls with top-level await to fix oxlint no-floating-promises errors. This ensures examples run to completion and any errors are properly surfaced. - examples/index.ts: await quickstart() - examples/openai-integration.ts: await openaiIntegration() - examples/ai-sdk-integration.ts: await aiSdkIntegration() - examples/human-in-the-loop.ts: await humanInTheLoopExample() - examples/meta-tools.ts: await main() in import.meta.main guard
1 parent b196d6d commit 5ae7029

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

examples/ai-sdk-integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ const aiSdkIntegration = async (): Promise<void> => {
4141
assert(text.includes('Michael'), 'Expected employee name to be included in the response');
4242
};
4343

44-
aiSdkIntegration();
44+
await aiSdkIntegration();

examples/human-in-the-loop.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ const simulateHumanValidation = async (toolCall: ToolCall): Promise<boolean> =>
103103
return true;
104104
};
105105

106-
humanInTheLoopExample();
106+
await humanInTheLoopExample();

examples/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const quickstart = async (): Promise<void> => {
7575
};
7676

7777
// Run the example
78-
quickstart();
78+
await quickstart();
7979

8080
/**
8181
* # Next Steps

examples/meta-tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ const main = async () => {
272272

273273
// Run if this file is executed directly
274274
if (import.meta.main) {
275-
main();
275+
await main();
276276
}
277277

278278
export { metaToolsWithAISDK, metaToolsWithOpenAI, directMetaToolUsage, dynamicToolRouter };

examples/openai-integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,4 @@ const openaiIntegration = async (): Promise<void> => {
6666
};
6767

6868
// Run the example
69-
openaiIntegration();
69+
await openaiIntegration();

0 commit comments

Comments
 (0)