Skip to content

Commit

Permalink
GITBOOK-178: No subject
Browse files Browse the repository at this point in the history
  • Loading branch information
Ambika Joshi authored and gitbook-bot committed Oct 18, 2024
1 parent 2811256 commit 4ac9b0b
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 11 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .gitbook/assets/image (22).png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
* [🔍 Generate “People Also Ask” SEO Content](guides/generate-people-also-ask-seo-content.md)
* [📊 How to create language evaluation for ASR?](guides/how-to-create-language-evaluation-for-asr.md)
* [How does RAG-based document search work?](guides/how-does-rag-based-document-search-work.md)
* [🧩 How to use Gooey Functions?](guides/how-to-use-gooey-functions.md)
* [🧩 How to use Gooey Functions?](guides/how-to-use-gooey-functions/README.md)
* [✨ LLM-enabled Functions](guides/how-to-use-gooey-functions/llm-enabled-functions.md)
* [How to use Compare AI Translations?](guides/how-to-use-compare-ai-translations/README.md)
* [Google Translate Glossary](guides/how-to-use-compare-ai-translations/google-translate-glossary.md)
* [⚖️ Understanding Bulk Runner and Evaluation](guides/understanding-bulk-runner-and-evaluation/README.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ We will take the "Gooey Chat Bot Analysis Script" in this example. This LLM scri

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

<figure><img src="../.gitbook/assets/hubspot.jpg" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/hubspot.jpg" alt=""><figcaption></figcaption></figure>

<figure><img src="../.gitbook/assets/Screenshot 2024-08-09 at 1.54.11 PM.png" alt=""><figcaption><p>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</p></figcaption></figure>
<figure><img src="../../.gitbook/assets/Screenshot 2024-08-09 at 1.54.11 PM.png" alt=""><figcaption><p>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</p></figcaption></figure>

{% embed url="https://gooey.ai/compare-large-language-models/gooey-bot-chat-analysis-script-27lrilywfzmv/" %}
LINK TO THE LLM ANAYLSIS SCRIPT
Expand Down Expand Up @@ -47,19 +47,19 @@ async (variables) => {
```
{% endcode %}

<figure><img src="../.gitbook/assets/Screenshot 2024-08-09 at 9.58.52 PM.png" alt=""><figcaption><p>Functions workflow with the code editor to the left</p></figcaption></figure>
<figure><img src="../../.gitbook/assets/Screenshot 2024-08-09 at 9.58.52 PM.png" alt=""><figcaption><p>Functions workflow with the code editor to the left</p></figcaption></figure>

### **Step 3**

Add your relevant variables.&#x20;

<figure><img src="../.gitbook/assets/variables.gif" alt="" width="375"><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/variables.gif" alt="" width="375"><figcaption></figcaption></figure>

### **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.

<figure><img src="../.gitbook/assets/saveasnew.gif" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/saveasnew.gif" alt=""><figcaption></figcaption></figure>

### **Step 5**

Expand All @@ -69,15 +69,15 @@ Head over to the example below:&#x20;

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

<figure><img src="../.gitbook/assets/Screenshot 2024-08-06 at 11.36.19 AM.png" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/Screenshot 2024-08-06 at 11.36.19 AM.png" alt=""><figcaption></figcaption></figure>

Check the Functions, choose “AFTER” and add your Saved example. And then hit "SUBMIT!&#x20;

<figure><img src="../.gitbook/assets/Screenshot 2024-08-06 at 11.36.19 AM (1).png" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/Screenshot 2024-08-06 at 11.36.19 AM (1).png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="../.gitbook/assets/Screenshot 2024-08-09 at 2.02.41 PM (1).png" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/Screenshot 2024-08-09 at 2.02.41 PM (1).png" alt=""><figcaption></figcaption></figure>

### How do I find all the available functions and how can I contribute? <a href="#id-86mplbjxoi5t" id="id-86mplbjxoi5t"></a>

Expand All @@ -87,8 +87,8 @@ All the functions are available here:

Choose any of the Examples and Fork them!

<figure><img src="../.gitbook/assets/examplesection.gif" alt=""><figcaption></figcaption></figure>
<figure><img src="../../.gitbook/assets/examplesection.gif" alt=""><figcaption></figcaption></figure>

### More resources

<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><h4>Read more about GOOEY.AI functions</h4></td><td><a href="https://app.gitbook.com/s/leYcqBx5FRZcVr3wI4f4/fun-fun-functions">Fun fun functions!</a></td><td><a href="../.gitbook/assets/gooey.ai - cute robot doing javascript vintage p...gazine advertisement muted colorful illustration.png">gooey.ai - cute robot doing javascript vintage p...gazine advertisement muted colorful illustration.png</a></td></tr><tr><td><h4>Connect API to LLM Generator</h4></td><td><a href="https://gooey.ai/compare-large-language-models/functions-make-a-haiku-with-iss-coordinates-k4vuehh6hhvo/">https://gooey.ai/compare-large-language-models/functions-make-a-haiku-with-iss-coordinates-k4vuehh6hhvo/</a></td><td><a href="../.gitbook/assets/gooey.ai - cute robots and aliens shaking hands ...gazine advertisement muted colorful illustration.png">gooey.ai - cute robots and aliens shaking hands ...gazine advertisement muted colorful illustration.png</a></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
<table data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><h4>Read more about GOOEY.AI functions</h4></td><td><a href="https://app.gitbook.com/s/leYcqBx5FRZcVr3wI4f4/fun-fun-functions">Fun fun functions!</a></td><td><a href="../../.gitbook/assets/gooey.ai - cute robot doing javascript vintage p...gazine advertisement muted colorful illustration.png">gooey.ai - cute robot doing javascript vintage p...gazine advertisement muted colorful illustration.png</a></td></tr><tr><td><h4>Connect API to LLM Generator</h4></td><td><a href="https://gooey.ai/compare-large-language-models/functions-make-a-haiku-with-iss-coordinates-k4vuehh6hhvo/">https://gooey.ai/compare-large-language-models/functions-make-a-haiku-with-iss-coordinates-k4vuehh6hhvo/</a></td><td><a href="../../.gitbook/assets/gooey.ai - cute robots and aliens shaking hands ...gazine advertisement muted colorful illustration.png">gooey.ai - cute robots and aliens shaking hands ...gazine advertisement muted colorful illustration.png</a></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
100 changes: 100 additions & 0 deletions guides/how-to-use-gooey-functions/llm-enabled-functions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# ✨ LLM-enabled Functions

## Where are LLM-enabled Functions useful?

There are many scenarios where we don't need to run the Functions for every Copilot query. For example:

* User wants to calculate data in between the conversation (like an HVAC CFM Calculation)
* LLM needs to do a Google search to respond to the query
* LLM needs to do a look-up weather API and answer the query&#x20;

<figure><img src="../../.gitbook/assets/pako_eNptkstugzAQRX9l5HXyAywqNSEkqdIu-tgUsrDwEKxim_qhNCL59w6GJKgqYoG5Z67njt2x0ghkCTtY3tbwnhYa6HnMPxxa4O7LAYfvgPa0h_n8ARbdbvdM_x32L8gKqqBLL40m0CJoRIHiMrgsqOSc3fRBO_c2y7y3sehao4WDo_T1zYh8DkGh9m4_2Czjzml-dQLpoORNg2Io_MunkV_defzBMni86quoZ3fdog-.png" alt="" width="492"><figcaption><p>A flowchart which shows the different flows </p></figcaption></figure>

## How do LLM-enabled Functions work?

When the user sends a query in Natural Language, the LLM determines the following:&#x20;

1. does the query require a function?
2. which part of the text should be passed as an argument in the function?

In the example below, the query is about CFM calculations which are commonly used in HVAC installations.&#x20;

<figure><img src="../../.gitbook/assets/image (22).png" alt=""><figcaption></figcaption></figure>

## How to use LLM-enabled Functions?

Using LLM-enabled Functions is exactly the same as "BEFORE" and "AFTER" functions

### **Step 1** <a href="#step-1" id="step-1"></a>

Head over the [Functions workflow](https://gooey.ai/functions/)

### **Step 2** <a href="#step-2" id="step-2"></a>

Create your PROMPT Function:

* create a basic fetch call for the weather of any location
* create a serper&#x20;

**You can find more** [**examples here**](https://gooey.ai/functions/examples)

#### A basic Weather API call ([link here](https://gooey.ai/functions/current-weather-rxmquy60p1vq/))

```javascript
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 };
};
```

#### An API call for serper - a service for google search ([link here](https://gooey.ai/functions/google-search-without-api-key-tey6zrx2vzvm/))

```javascript
async ({ query }) => {
var myHeaders = new Headers();
myHeaders.append("X-API-KEY", "your API key");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
"q": query
});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

let ret = await fetch("https://google.serper.dev/search", requestOptions);

return { search_results: await ret.json() };
};

```

#### **Step 3** <a href="#step-3" id="step-3"></a>

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** <a href="#step-5" id="step-5"></a>

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/copilot/farmerchat-with-current-weather-data-qfzn662xf06v/" %}

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

<figure><img src="../../.gitbook/assets/Screenshot 2024-10-19 at 1.03.32 AM.png" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://docs.gooey.ai/~gitbook/image?url=https%3A%2F%2F662560811-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F5BFP5RUm6rTLXk8wUSTf%252Fuploads%252FenY8Js0Pe22WJWCN5Ook%252FScreenshot%25202024-08-09%2520at%25202.02.41%25E2%2580%25AFPM.png%3Falt%3Dmedia%26token%3D7386368f-50b3-4def-b495-977fcb610b40&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=c63c07c8&#x26;sv=1" alt=""><figcaption></figcaption></figure>

<figure><img src="../../.gitbook/assets/Screenshot 2024-10-19 at 1.15.29 AM.png" alt=""><figcaption></figcaption></figure>

0 comments on commit 4ac9b0b

Please sign in to comment.