File tree Expand file tree Collapse file tree 4 files changed +55
-0
lines changed
packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool Expand file tree Collapse file tree 4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ import { tool } from 'ai' ;
2+ import { z } from 'zod' ;
3+
4+ export const weatherTool = tool ( {
5+ description : 'Get the weather in a location' ,
6+ parameters : z . object ( {
7+ location : z . string ( ) . describe ( 'The location to get the weather for' ) ,
8+ } ) ,
9+ execute : async ( { location } ) => {
10+ 'use step' ;
11+ const response = await fetch (
12+ `https://api.weather.com/v1/current?location=${ location } `
13+ ) ;
14+ return response . json ( ) ;
15+ } ,
16+ } ) ;
Original file line number Diff line number Diff line change 1+ import { tool } from 'ai' ;
2+ import { z } from 'zod' ;
3+ export const weatherTool = tool ( {
4+ description : 'Get the weather in a location' ,
5+ parameters : z . object ( {
6+ location : z . string ( ) . describe ( 'The location to get the weather for' )
7+ } ) ,
8+ execute : async ( { location } ) => {
9+ 'use step' ;
10+ const response = await fetch ( `https://api.weather.com/v1/current?location=${ location } ` ) ;
11+ return response . json ( ) ;
12+ }
13+ } ) ;
Original file line number Diff line number Diff line change 1+ import { tool } from 'ai' ;
2+ import { z } from 'zod' ;
3+ export const weatherTool = tool ( {
4+ description : 'Get the weather in a location' ,
5+ parameters : z . object ( {
6+ location : z . string ( ) . describe ( 'The location to get the weather for' )
7+ } ) ,
8+ execute : async ( { location } ) => {
9+ 'use step' ;
10+ const response = await fetch ( `https://api.weather.com/v1/current?location=${ location } ` ) ;
11+ return response . json ( ) ;
12+ }
13+ } ) ;
Original file line number Diff line number Diff line change 1+ import { tool } from 'ai' ;
2+ import { z } from 'zod' ;
3+ export const weatherTool = tool ( {
4+ description : 'Get the weather in a location' ,
5+ parameters : z . object ( {
6+ location : z . string ( ) . describe ( 'The location to get the weather for' )
7+ } ) ,
8+ execute : async ( { location } ) => {
9+ 'use step' ;
10+ const response = await fetch ( `https://api.weather.com/v1/current?location=${ location } ` ) ;
11+ return response . json ( ) ;
12+ }
13+ } ) ;
You can’t perform that action at this time.
0 commit comments