Skip to content

Latest commit

 

History

History
94 lines (55 loc) · 5.19 KB

File metadata and controls

94 lines (55 loc) · 5.19 KB

🧩 How to use Gooey Functions?

In this guide, we will learn how to create a functions call on Gooey.AI and add it to our Gooey.AI workflows.

We'll take the example of our Copilot Analysis Scripts. All copilots have an integrated LLM script to analyze various user data. This could be user location, question category, user sentiment, etc. Once you have the data, you might want to push it to your servers, or database, or combine it with your other services.

Scenario

We will take the "Gooey Chat Bot Analysis Script" in this example. This LLM script analyzes the incoming messages to our Gooey.AI Support Bot and categorizes the user's query into buckets like API Usage, Pricing, Sales, etc.

We want to push this output to our CRM so we get deeper analytics which helps us respond better to our customers.

Gooey Support Bot's Analysis script, on the left is the LLM prompt with the incoming message and on the right is the category output

{% embed url="https://gooey.ai/compare-large-language-models/gooey-bot-chat-analysis-script-27lrilywfzmv/" %} LINK TO THE LLM ANAYLSIS SCRIPT {% endembed %}

How do you add functions to your Gooey workflows?

Step 1

Head over the Functions workflow

Step 2

Create your POST Request with AFTER Function:

Here is a basic fetch call, you can copy or edit this code as per your needs, and paste it in the code editor on the Functions workflow.

Currently, we have added httpbin for our POST request, you can change this for your preferred API. You can find more examples here

{% code title="A basic fetch call" lineNumbers="true" %}

async (variables) => {
  const res = await fetch("https://httpbin.org/post", {
    method: "POST",
    body: JSON.stringify(variables),
    headers: {
      "Content-Type": "application/json",
    },
  });
  return { response: await res.json() };
};

{% endcode %}

Functions workflow with the code editor to the left

Step 3

Add your relevant variables.

Step 4

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 5

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

Head over to the example below:

{% embed url="https://gooey.ai/compare-large-language-models/gooey-bot-chat-analysis-script-27lrilywfzmv/" %}

Check the Functions, choose “AFTER” 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.

How do I find all the available functions and how can I contribute?

All the functions are available here:

{% embed url="https://gooey.ai/functions/examples/" %}

Choose any of the Examples and Fork them!

More resources

Read more about GOOEY.AI functions

Fun fun functions!gooey.ai - cute robot doing javascript vintage p...gazine advertisement muted colorful illustration.png

Connect API to LLM Generator

https://gooey.ai/compare-large-language-models/functions-make-a-haiku-with-iss-coordinates-k4vuehh6hhvo/gooey.ai - cute robots and aliens shaking hands ...gazine advertisement muted colorful illustration.png