You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(ai): remove all experimental embed events (#13693)
## Background
the changes from #13478 were backported
when they shouldn't have been.
## Summary
cherry pick and revert all the changes
## Manual Verification
na
## Checklist
- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
description: Subscribe to lifecycle events in generateText, streamText, embed, and embedMany calls
3
+
description: Subscribe to lifecycle events in generateTextand streamText calls
4
4
---
5
5
6
6
# Event Callbacks
7
7
8
-
The AI SDK provides per-call event callbacks that you can pass to `generateText`, `streamText`, `embed`, and `embedMany` to observe lifecycle events. This is useful for building observability tools, logging systems, analytics, and debugging utilities.
8
+
The AI SDK provides per-call event callbacks that you can pass to `generateText`and `streamText` to observe lifecycle events. This is useful for building observability tools, logging systems, analytics, and debugging utilities.
9
9
10
10
## Basic Usage
11
11
12
-
Pass callbacks directly to `generateText`, `streamText`, `embed`, or `embedMany`:
12
+
Pass callbacks directly to `generateText`or `streamText`:
13
13
14
14
```ts
15
15
import { generateText } from'ai';
@@ -28,8 +28,6 @@ const result = await generateText({
28
28
29
29
## Available Callbacks
30
30
31
-
### `generateText` / `streamText`
32
-
33
31
<PropertiesTable
34
32
content={[
35
33
{
@@ -67,30 +65,9 @@ const result = await generateText({
'Called when the embedding operation completes, after the embedding model returns.',
85
-
},
86
-
]}
87
-
/>
88
-
89
68
## Event Reference
90
69
91
-
### `generateText` / `streamText`
92
-
93
-
#### `experimental_onStart`
70
+
### `experimental_onStart`
94
71
95
72
Called when the generation operation begins, before any LLM calls are made.
96
73
@@ -244,7 +221,7 @@ const result = await generateText({
244
221
]}
245
222
/>
246
223
247
-
####`experimental_onStepStart`
224
+
### `experimental_onStepStart`
248
225
249
226
Called before each step (LLM call) begins. Useful for tracking multi-step generations.
250
227
@@ -358,7 +335,7 @@ const result = await generateText({
358
335
]}
359
336
/>
360
337
361
-
####`experimental_onToolCallStart`
338
+
### `experimental_onToolCallStart`
362
339
363
340
Called before a tool's `execute` function runs.
364
341
@@ -450,7 +427,7 @@ const result = await generateText({
450
427
]}
451
428
/>
452
429
453
-
####`experimental_onToolCallFinish`
430
+
### `experimental_onToolCallFinish`
454
431
455
432
Called after a tool's `execute` function completes or errors. Uses a discriminated union on the `success` field.
456
433
@@ -571,7 +548,7 @@ const result = await generateText({
571
548
]}
572
549
/>
573
550
574
-
####`onStepFinish`
551
+
### `onStepFinish`
575
552
576
553
Called after each step (LLM call) completes. Provides the full `StepResult`.
577
554
@@ -712,7 +689,7 @@ const result = await generateText({
712
689
]}
713
690
/>
714
691
715
-
####`onFinish`
692
+
### `onFinish`
716
693
717
694
Called when the entire generation completes (all steps finished). Includes aggregated data.
718
695
@@ -864,164 +841,6 @@ const result = await generateText({
864
841
]}
865
842
/>
866
843
867
-
### `embed` / `embedMany`
868
-
869
-
#### `experimental_onStart`
870
-
871
-
Called when the embedding operation begins, before the embedding model is called. Both `embed` and `embedMany` share the same event interface; the `operationId` field distinguishes them (`'ai.embed'` vs `'ai.embedMany'`), and the `value` field is a single string for `embed` or an array of strings for `embedMany`.
'Identifier from telemetry settings for grouping related operations.',
935
-
},
936
-
{
937
-
name: 'metadata',
938
-
type: 'Record<string, JSONValue> | undefined',
939
-
description: 'Additional metadata from telemetry settings.',
940
-
},
941
-
]}
942
-
/>
943
-
944
-
#### `experimental_onFinish`
945
-
946
-
Called when the embedding operation completes. For `embed`, `embedding` is a single vector and `response` is a single response object. For `embedMany`, `embedding` is an array of vectors and `response` is an array of response objects (one per chunk).
Errors thrown inside callbacks are caught and do not break the generation or embedding flow. This ensures that monitoring code cannot disrupt your application:
904
+
Errors thrown inside callbacks are caught and do not break the generation flow. This ensures that monitoring code cannot disrupt your application:
0 commit comments