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
Copy file name to clipboardExpand all lines: docs/snippets/migrate-v4-using-ai.mdx
+18-23Lines changed: 18 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,21 @@
1
1
<Accordiontitle="Copy paste this prompt in full"icon="sparkles">
2
2
3
+
```md
4
+
3
5
I would like you to help me migrate my v3 task code to v4. Here are the important differences:
4
6
5
7
We've deprecated the `@trigger.dev/sdk/v3` import path and moved to a new path:
6
8
7
-
```ts
8
9
// This is the old path
9
10
import { task } from "@trigger.dev/sdk/v3";
10
11
11
12
// This is the new path, use this instead
12
13
import { task } from "@trigger.dev/sdk";
13
-
```
14
14
15
15
We've renamed the `handleError` hook to `catchError`. Use this instead of `handleError`.
16
16
17
17
`init` was previously used to initialize data used in the run function. This is the old version:
18
18
19
-
```ts
20
19
import { task } from "@trigger.dev/sdk";
21
20
22
21
const myTask = task({
@@ -30,11 +29,9 @@ const myTask = task({
30
29
await client.doSomething();
31
30
},
32
31
});
33
-
```
34
32
35
33
This is the new version using middleware and locals:
36
34
37
-
```ts
38
35
import { task, locals, tasks } from "@trigger.dev/sdk";
39
36
40
37
// Create a local for your client
@@ -58,11 +55,9 @@ const myTask = task({
58
55
await client.doSomething();
59
56
},
60
57
});
61
-
```
62
58
63
59
We’ve deprecated the `toolTask` function and replaced it with the `ai.tool` function, which creates an AI tool from an existing `schemaTask`. This is the old version:
64
60
65
-
```ts
66
61
import { toolTask, schemaTask } from "@trigger.dev/sdk";
We've made several breaking changes that require code updates:
130
122
131
123
**Queue changes**: Queues must now be defined ahead of time using the `queue` function. You can no longer create queues "on-demand" when triggering tasks. This is the old version:
0 commit comments