01.01.2024
713

OpenAI (ChatGPT)

How to Connect OpenAI (ChatGPT)

Integration with OpenAI (ChatGPT) is implemented as a separate AI (ChatGPT) block, which can be placed between the Source and Reception of data. This will allow you to create a query based on data from the Data Source and pass data from OpenAI (ChatGPT) to the Data Ingest fields. This way you can automatically receive data from OpenAI (ChatGPT) and transfer it to the services and systems that you use.

The function allows you to create a request in OpenAI (ChatGPT) and send the result of the request to Data Destination.

Navigation:

Connecting Google Sheets as a Data Source:

1. What data can you get from Google Sheets?
2. How to connect your Google Sheets account to ApiX-Drive?
3. Select the table and sheet from which rows will be unloaded.
4. An example of data that will be transferred from Google Sheets.

Connecting OpenAI (ChatGPT):

1. What data can be obtained from OpenAI (ChatGPT)?
2. How to connect your OpenAI (ChatGPT) account to ApiX-Drive?
3. How to configure data search in OpenAI (ChatGPT) in the selected action?
Send PROMPT (GPT-4)
Send PROMPT (GPT-3.5)
Send PROMPT (GPT-base / instead of GPT-3)
Send PROMPT (GPT-3 legacy)
Create IMAGE (DALL-E 3)
Create IMAGE (DALL-E 2)
Check MODERATION
Create EDIT
4. An example of data that will be transferred from OpenAI (ChatGPT).

Setting up row updates in Google Sheets:
1. What will the Google Sheets integration do?
2. How to connect your Google Sheets account to ApiX-Drive?
3. How can I configure the selected action to transfer data to Google Sheets?
4. Example of data that will be sent to your Google Sheets.
5. Auto-update and communication interval.

Setting up Data SOURCE: Google Sheets

Let's look at how the function of requesting data from OpenAI (ChatGPT) and sending the result to Google Sheets works.

First, you need to create a new connection.

Setting up OpenAI (ChatGPT) in Google Sheets | Creating a connection

Select the system as the Data Source. In this case, you must specify Google Sheets.

Setting up OpenAI (ChatGPT) in Google Sheets | System selection

Next, you need to specify the action "Get ROWS (new)".

Setting up OpenAI (ChatGPT) in Google Sheets | Action selection

The next step is to select the Google Sheets account from which the data will be uploaded.

If there are no logins connected to the system, click "Connect account".  

Setting up OpenAI (ChatGPT) in Google Sheets | Connecting account

Select which account you want to connect to ApiX-Drive and provide all permissions to work with this account.

Setting up OpenAI (ChatGPT) in Google Sheets | Select a Google account to connect

When the connected account appears in the "active accounts" list, select it for further work.

Attention! If your account is on the "inactive accounts" list, check your access to this login!

Setting up OpenAI (ChatGPT) in Google Sheets | Account selection

Select the Google Sheets table and sheet where the data you need is located.

Setting up OpenAI (ChatGPT) in Google Sheets | Table and Sheet Selection

If necessary, you can set up a Data Filter, or click "Continue" to skip this step.

To find out how to setup the Data Filter, follow the link: https://apix-drive.com/en/help/data-filter

Setting up OpenAI (ChatGPT) in Google Sheets | Data filter

Now you can see the test data for one of the rows in your Google Sheets.

If you want to update the test data - click "Load test data from Google Sheets".

If you want to change the settings - click "Edit" and you will go back one step.  

Setting up OpenAI (ChatGPT) in Google Sheets | Test data

Now we connect the additional OpenAI block (ChatGPT). To do this, click on “+” and select “AI (GPT-Chat)” from the list.

Setting up OpenAI (ChatGPT) in Google Sheets | Add OpenAI (ChatGPT) block

Setting up OpenAI (ChatGPT)

Select "OpenAI (ChatGPT)" as the system in which the search will be performed.

Setting up OpenAI (ChatGPT) in Google Sheets | System selection

Next, you need to specify the action, for example, “Send PROMPT (GPT-4)”.

Setting up OpenAI (ChatGPT) in Google Sheets | Action selection

- Send PROMPT (GPT-4) is a large multi-modal model that can solve complex problems with greater accuracy.
(Available in the API for paid OpenAI users only!)
- Send PROMPT (GPT-3.5) - these models can understand and generate natural language or code. The most functional and economical model of the GPT-3.5 family is gpt-3.5-turbo.
- Send PROMPT (GPT-base / instead of GPT-3) - GPT base models can understand and generate natural language or code, but are not trained through instructions.
- Send PROMPT (GPT-3 obsolete) - these models can understand and generate natural language or code. They are outdated models.
- Generate IMAGE (DALL-E 3) is the latest model of DALL-E that can create realistic images and works of art based on natural language descriptions. DALL-E 3 currently supports the ability to create a new image of a specific size on demand.
- Generate IMAGE (DALL-E 2) - the previous DALL-E model, supports the ability to edit an existing image or create variations of a user-supplied image.
- Check MODERATION - moderation models are designed to check content compliance with OpenAI usage policies.
- Create EDIT - allows you to edit text and code.

The next step is to select an OpenAI (ChatGPT) account.

If there are no logins connected to the ApiX-Drive system, click “Connect account”.

Setting up OpenAI (ChatGPT) in Google Sheets | Connecting account

Enter the API key, which is located in the settings of your OpenAI (ChatGPT) personal account.

Go to your OpenAI (ChatGPT) account, click on the “Personal” tab in the upper right corner, then go to the “View API keys” section and click “Create new secret key”. Copy the API key and paste it into the appropriate field in the account connection window in the ApiX-Drive system.

If your OpenAI (ChatGPT) account belongs to multiple organizations, you must also provide the Organization ID. To do this, go to "Settings" and copy the Organization ID.

Click "Save" and select the connected OpenAI (ChatGPT) account from the drop-down list.

Setting up OpenAI (ChatGPT) in Google Sheets | Account conection
Setting up OpenAI (ChatGPT) in Google Sheets | Account conection
Setting up OpenAI (ChatGPT) in Google Sheets | Account conection
Setting up OpenAI (ChatGPT) in Google Sheets | Account conection

When the connected account appears in the "active accounts" list, select it for further work.

Attention! If your account is on the "inactive accounts" list, check your access to this login!

Setting up OpenAI (ChatGPT) in Google Sheets | Account selection


Example of setting up fields and test data for the "Send PROMPT (GPT-4)" action

Now you need to select OpenAI Model. The choice of model depends on your task.
GPT-4 models can solve complex problems with greater accuracy than previous models. GPT-4 is optimized for chat and has JSON mode. Models are suitable for writing code, analyzing and writing texts, answering questions about the knowledge base. These models also do a better job of translating into other languages than previous models.
More details about models:
GPT-4

In this case, select, for example, "GPT-4 Turbo with Vision (128k)".

Setting up OpenAI (ChatGPT) in Google Sheets | Setting up OpenAI (ChatGPT) GPT-4

- Prompt - in this field you need to assign which variable of the Data Source table contains the data for which the query will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.
- Maximum tokens - is the number of words up to which generation will continue in OpenAI. 1,000 tokens - 750 words.
-Presence penalty - This parameter is used to encourage the model to include a variety of tokens in the generated text. This is the value that is subtracted from the log likelihood of the token each time it is generated. A higher Presence Penalty value will cause the model to be more likely to generate tokens that were not already included in the generated text.
-Frequency penalty - this parameter is used to prevent the model from repeating the same words or phrases too often in the generated text. This is the value that is added to the log likelihood of the token each time it appears in the generated text. A higher Frequency Penalty value will cause the model to be more conservative in its use of duplicate tokens.
-Temperature - can range from 0 to 2. Higher values such as 0.8 will make the output more random, while lower values such as 0.2 will make it more focused and deterministic.

Answering GPT-4 knowledge base questions and generating text
Use GPT-4 models to answer your questions. This model can also be used to generate text according to the specified criteria.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data
Setting up OpenAI (ChatGPT) in Google Sheets | Test data

GPT-4 Unstructured Text Analysis
With GPT-4 you can analyze your text and structure it according to specified criteria. You can use this to analyze your emails, create tables, extract keywords, classify text, etc.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "
Send PROMPT (GPT-3.5) " action

Now you need to select OpenAI Model. The choice of model depends on your task.

GPT-3.5 models can understand and generate natural language or code. Functional and economically optimal models. Suitable for traditional tasks such as analysis or generation of text and code, translation of texts.

More details about models:

GPT-3.5

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

- Prompt - in this field you need to assign which variable of the Data Source table contains the data for which the query will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.
- Maximum tokens - is the number of words up to which generation will continue in OpenAI. 1,000 tokens - 750 words.
-Presence penalty - This parameter is used to encourage the model to include a variety of tokens in the generated text. This is the value that is subtracted from the log likelihood of the token each time it is generated. A higher Presence Penalty value will cause the model to be more likely to generate tokens that were not already included in the generated text.
-Frequency penalty - this parameter is used to prevent the model from repeating the same words or phrases too often in the generated text. This is the value that is added to the log likelihood of the token each time it appears in the generated text. A higher Frequency Penalty value will cause the model to be more conservative in its use of duplicate tokens.
-Temperature - can range from 0 to 2. Higher values such as 0.8 will make the output more random, while lower values such as 0.2 will make it more focused and deterministic.  

Generation of the text GPT-3.5

With GPT-3.5 you can generate articles on a topic you specify with the parameters you specify.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields GPT-3.5

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data

GPT-3.5 text translation

With GPT-3.5 you can translate your articles into the languages you need.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the action "
Send PROMPT (GPT-base / instead of GPT-3)"

Now you need to select OpenAI Model. The choice of model depends on your task.

GPT-base models are a replacement for the original GPT-3 base models. These models can understand both code and natural language, but are not trained using instructions. Models are trained on data up to 2021. Suitable for basic tasks.

More details about models:

GPT-base

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

- Prompt - in this field you need to assign which variable of the Data Source table contains the data for which the query will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.
- Maximum tokens - is the number of words up to which generation will continue in OpenAI. 1,000 tokens - 750 words.
-Temperature - can range from 0 to 2. Higher values such as 0.8 will make the output more random, while lower values such as 0.2 will make it more focused and deterministic.  

Extracting key points from GPT-base text

With GPT-base you can extract key points from the text you specify.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "
Send PROMPT (GPT-3 legacy)" 

Now you need to select OpenAI Model. The choice of model depends on your task.

GPT-3 models can understand and generate natural language. Able to solve simple problems quickly and cost-effectively. Training base until 2019.

More details about models:

GPT-3

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

- Prompt - in this field you need to assign which variable of the Data Source table contains the data for which the query will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.
- Maximum tokens - is the number of words up to which generation will continue in OpenAI. 1,000 tokens - 750 words.
-Temperature - can range from 0 to 2. Higher values such as 0.8 will make the output more random, while lower values such as 0.2 will make it more focused and deterministic.  

Completing the GPT-3 proposal

With GPT-3 you can generate data based on a sentence completion database.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "Generate IMAGE (DALL-E 3)" action

DALL-E is an artificial intelligence system that can create realistic images and works of art based on natural language descriptions. DALL-E 3 currently supports the ability to create a new image of a specific size on demand.

More details about models:

DALL-E 3

DALL-E 3 image generation

With DALL-E 3 you can generate images based on the parameters you specify.

Select the image size, and also select the quality and style for generating the image.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "
Generate IMAGE (DALL-E 2)" action

DALL-E is an artificial intelligence system that can create realistic images and works of art based on natural language descriptions. DALL-E 2 also supports the ability to edit an existing image or create variations of a user-supplied image.

More details about models:

DALL-E 2

Editing an existing DALL-E 2 image

With DALL-E 2 you can generate images based on the parameters you specify.

Select the image size and indicate your request.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "Check MODERATION" action

Moderation models allow you to review content for compliance with OpenAI usage policies.
The models provide classification capabilities that allow you to search for content in the following categories: hate, hate/threats, self-harm, sexual, sexual/minor, violence, and violent/imagery.

More details about models:

Check MODERATION

Select a model.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

- Text for processed - in this field you need to assign which variable of the Data Source table contains the data for which the request will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data


Example of setting up fields and test data for the "Check EDIT" action

With Editing models you can edit text and code.

Select a model.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

- Text for processed - in this field you need to assign which variable of the Data Source table contains the data for which the request will be made on the OpenAI server (ChatGPT), in our case, this is column “A”.

- Prompt - an action that needs to be performed with the text.

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Now you see test data for your request. You can pass this data to your reception table.

If test data does not appear automatically, click "Search in OpenAI (ChatGPT)".

If you are not satisfied with something, click “Edit”, go back a step and change the search field settings.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data

This completes the OpenAI (ChatGPT) data setup!

Now we can start setting up Google Sheets as a Data Reception system.

To do this, click "Add Data Receiver".

Setting up OpenAI (ChatGPT) in Google Sheets | Setup Data Destination system

Setup Data Destination system: Google Sheets

Select the system as Data Destination. In this case, you must specify Google Sheets.

Setting up OpenAI (ChatGPT) in Google Sheets | System selection

Next, you need to specify the action "Update ROW".

Setting up OpenAI (ChatGPT) in Google Sheets | Action selection

The next step is to select a Google Sheets account into which the result of the OpenAI (ChatGPT) request will be transferred. If this is the same account, then we select it.

If you need to connect another login to the system, click “Connect account” and repeat the same steps described when connecting Google Sheets as a Data Source.

Setting up OpenAI (ChatGPT) in Google Sheets | Account selection

Now you need to select the File (Table) and Sheet in which the status of OpenAI (ChatGPT) will be updated.

In the "Search column" field, you need to select the column by which the data will be searched. That is, where to look for data in the table.

Next, in the "Search" field, you need to select a variable from the drop-down list or enter the data manually, by which value the system will search for data to update the row you need. In our case, we select column "A", which contains the data about the request. The system will update the data in the desired row only if it matches the requested data.

Also, you need to specify the Search Type, in case several rows with the same query are found:

"Take the first found row" - searching and updating data will occur in the first found row that satisfies the search conditions.

"Take the last found row" - searching and updating data will occur in the last found row that satisfies the search conditions.

"Take all found rows" - search and update of data will be performed on all found rows that satisfy the search conditions.

Now you need to assign a variable with the result of the query, which we take from the Data Search block, to the empty column. In the future, this column will be updated according to your request.

After setting, click "Continue".

Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields
Setting up OpenAI (ChatGPT) in Google Sheets | Assigning fields

Thus, the OpenAI (ChatGPT) block takes the field in the Data Source in which you have written the request text, queries the OpenAI server (ChatGPT) for the result of this request and transfers this data to the Data Reception field, for example, in column “B”.

Setting up OpenAI (ChatGPT) in Google Sheets | Test data
Setting up OpenAI (ChatGPT) in Google Sheets | Test data

This completes the Data Destination system setup!
Now you can start choosing the update interval and enabling auto-update.
To do this, click "Enable update".      

Setting up OpenAI (ChatGPT) in Google Sheets | Completing setup

On the main screen, click on the gear icon to select the required update interval or set up scheduled launch. To start the connection by time, select scheduled start and specify the desired time for the connection update to fire, or add several options at once when you need the connection to fire.

Attention! In order for the scheduled run to work at the specified time, the interval between the current time and the specified time must be more than 5 minutes. For example, you select the time 12:10 and the current time is 12:08 - in this case, the automatic update of the connection will occur at 12:10 the next day. If you select the time 12:20 and the current time is 12:13 - the auto-update of the connection will work today and then every day at 12:20.

To make the current connection transmit data only after another connection, check the box "Update connection only after start other connection" and specify the connection after which the current connection will be started.    

Setting up OpenAI (ChatGPT) in Google Sheets | Update interval
Setting up OpenAI (ChatGPT) in Google Sheets | Update priority

To enable auto-update, switch the slider to the position as shown in the picture.

To force the connection, click on the arrow icon.  

Setting up OpenAI (ChatGPT) in Google Sheets | Enable auto-update

This completes the setup of OpenAI (ChatGPT)! Everything is quite simple!

Now don't worry, ApiX-Drive will do everything on its own!