GPT-4 is an advanced language model that can be implemented in a script to answer various questions and solve problems using BPL operations.
To use GPT-4 in a script, do the following:
Install the Question and Statement block in the script.
Swipe the arrow from the Question block to the Statement block.
Click on the arrow.
Action type: Default.
Under Save answer, enter a variable name: question. The user's question will be saved to the variable.
Click on the Statement block.
Click Open editor. The BPL expression entry window will appear.
Write a function to work with chatGPT-4:
$answer = gpt.ask("gpt-4o", $question, 0.8)
Where:
$answer - a variable to which the response of the neural network will be written.$question - a query to the neural network in Russian or English.The name of the variable can be anything.
{answer} in the Message box.The timeout for receiving a response is 1 minute. If it takes more than 1 minute to get a response, a variable with an empty value will be returned.
Click the arrow from the Condition box.
Action type: OR condition.
Add two conditions by clicking the Add button:
20.1 Write {answer} in the first field of the first condition, leave the second field blank.
20.2 In the first field of the second condition write {answer}, in the second field write answer.
This condition checks if the neural network has responded, because if an empty value was returned, it means that the time to wait for a response has exceeded the maximum value of 1 minute.
(Optional) Connect the Information block with the Question block with an arrow if you want to loop the script. Also, make sure that the Cycles count is set to a high value in the start block.
The maximum number of cycles in a script is 100.
You can test the script in the editor. For more information about testing the script, see the article ChatGPT Assistant Management.
Once you have gone through the steps, you will create a script to use chatGPT-4 that will handle user questions and provide answers using BPL statements.