Module 9a: How to use Functions

Step 1

Head over to the Functions workflow

Step 2

Create your PROMPT Function:

  • create a basic fetch call for the weather of any location

  • create a serper

You can find more examples here

async ({ lat, long }) => {
  // Use Open-Meteo's public API for fetching weather data
  let url = `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${long}&current_weather=true`;
  let response = await fetch(url);
  let data = await response.json();
  return { weather: data.current_weather };
};

Step 3

Hit Submit, if your code is working fine you will get your outputs on the right side. Use the “Save as New” button and update the run name.

Step 4

Now head over to the Gooey workflow where you want to add the saved functions.

Head over to the example below:

Check the Functions option, and choose “PROMPT” from the dropdown and add your Saved example. And then hit "SUBMIT!

You can check your Functions output in the Workflow at the end of the page in "Details" section.

Last updated

Was this helpful?