We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 21ede4d commit de7c3a3Copy full SHA for de7c3a3
1 file changed
examples/ai-functions/src/stream-text/openai/abort.ts
@@ -8,6 +8,11 @@ run(async () => {
8
model: openai('gpt-3.5-turbo'),
9
prompt: 'Write a short story about a robot learning to love:\n\n',
10
abortSignal: AbortSignal.timeout(3000),
11
+ onAbort({ usage, totalUsage }) {
12
+ console.log('\n\nStream aborted.');
13
+ console.log('Usage at abort:', usage);
14
+ console.log('Total usage at abort:', totalUsage);
15
+ },
16
});
17
18
for await (const textPart of textStream) {
0 commit comments