diff --git a/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/input.js b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/input.js new file mode 100644 index 000000000..14864d5e6 --- /dev/null +++ b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/input.js @@ -0,0 +1,16 @@ +import { tool } from 'ai'; +import { z } from 'zod'; + +export const weatherTool = tool({ + description: 'Get the weather in a location', + parameters: z.object({ + location: z.string().describe('The location to get the weather for'), + }), + execute: async ({ location }) => { + 'use step'; + const response = await fetch( + `https://api.weather.com/v1/current?location=${location}` + ); + return response.json(); + }, +}); diff --git a/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-client.js b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-client.js new file mode 100644 index 000000000..23e7814a3 --- /dev/null +++ b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-client.js @@ -0,0 +1,13 @@ +import { tool } from 'ai'; +import { z } from 'zod'; +export const weatherTool = tool({ + description: 'Get the weather in a location', + parameters: z.object({ + location: z.string().describe('The location to get the weather for') + }), + execute: async ({ location })=>{ + 'use step'; + const response = await fetch(`https://api.weather.com/v1/current?location=${location}`); + return response.json(); + } +}); diff --git a/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-step.js b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-step.js new file mode 100644 index 000000000..23e7814a3 --- /dev/null +++ b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-step.js @@ -0,0 +1,13 @@ +import { tool } from 'ai'; +import { z } from 'zod'; +export const weatherTool = tool({ + description: 'Get the weather in a location', + parameters: z.object({ + location: z.string().describe('The location to get the weather for') + }), + execute: async ({ location })=>{ + 'use step'; + const response = await fetch(`https://api.weather.com/v1/current?location=${location}`); + return response.json(); + } +}); diff --git a/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-workflow.js b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-workflow.js new file mode 100644 index 000000000..23e7814a3 --- /dev/null +++ b/packages/swc-plugin-workflow/transform/tests/fixture/ai-sdk-tool/output-workflow.js @@ -0,0 +1,13 @@ +import { tool } from 'ai'; +import { z } from 'zod'; +export const weatherTool = tool({ + description: 'Get the weather in a location', + parameters: z.object({ + location: z.string().describe('The location to get the weather for') + }), + execute: async ({ location })=>{ + 'use step'; + const response = await fetch(`https://api.weather.com/v1/current?location=${location}`); + return response.json(); + } +});