File tree Expand file tree Collapse file tree 5 files changed +27
-31
lines changed Expand file tree Collapse file tree 5 files changed +27
-31
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @ai-sdk/provider-utils ' : patch
3
+ ' ai ' : patch
4
+ ---
5
+
6
+ chore(provider-utils): move ToolResultContent to provider-utils
Original file line number Diff line number Diff line change
1
+ import { ToolResultContent } from '@ai-sdk/provider-utils' ;
1
2
import { z } from 'zod' ;
2
3
3
- export type ToolResultContent = Array <
4
- | {
5
- type : 'text' ;
6
- text : string ;
7
- }
8
- | {
9
- type : 'image' ;
10
- data : string ; // base64 encoded png image, e.g. screenshot
11
- mediaType ?: string ; // e.g. 'image/png';
12
-
13
- /**
14
- * @deprecated Use `mediaType` instead.
15
- */
16
- mimeType ?: string ; // e.g. 'image/png';
17
- }
18
- > ;
4
+ export type { ToolResultContent } ;
19
5
20
6
export const toolResultContentSchema : z . ZodType < ToolResultContent > = z . array (
21
7
z . union ( [
Original file line number Diff line number Diff line change
1
+ import { ToolResultContent } from '@ai-sdk/provider-utils' ;
1
2
import { z } from 'zod' ;
2
3
3
- // Copied from ai package
4
4
type ExecuteFunction < PARAMETERS , RESULT > =
5
5
| undefined
6
6
| ( (
7
7
args : PARAMETERS ,
8
8
options : { abortSignal ?: AbortSignal } ,
9
9
) => Promise < RESULT > ) ;
10
10
11
- // Copied from ai package
12
- export type ToolResultContent = Array <
13
- | {
14
- type : 'text' ;
15
- text : string ;
16
- }
17
- | {
18
- type : 'image' ;
19
- data : string ; // base64 encoded png image, e.g. screenshot
20
- mediaType ?: string ; // e.g. 'image/png';
21
- }
22
- > ;
23
-
24
11
const Bash20241022Parameters = z . object ( {
25
12
command : z . string ( ) ,
26
13
restart : z . boolean ( ) . optional ( ) ,
Original file line number Diff line number Diff line change @@ -30,4 +30,4 @@ export type { Schema } from './schema';
30
30
export { zodSchema } from './zod-schema' ;
31
31
32
32
export type { ToolCall } from './types/tool-call' ;
33
- export type { ToolResult } from './types/tool-result' ;
33
+ export type { ToolResult , ToolResultContent } from './types/tool-result' ;
Original file line number Diff line number Diff line change @@ -23,3 +23,20 @@ Result of the tool call. This is the result of the tool's execution.
23
23
*/
24
24
result : RESULT ;
25
25
}
26
+
27
+ export type ToolResultContent = Array <
28
+ | {
29
+ type : 'text' ;
30
+ text : string ;
31
+ }
32
+ | {
33
+ type : 'image' ;
34
+ data : string ; // base64 encoded png image, e.g. screenshot
35
+ mediaType ?: string ; // e.g. 'image/png';
36
+
37
+ /**
38
+ * @deprecated Use `mediaType` instead.
39
+ */
40
+ mimeType ?: string ; // e.g. 'image/png';
41
+ }
42
+ > ;
You can’t perform that action at this time.
0 commit comments