The Function block is used to send requests to ChatGPT and GPT assistants created in the AI Hub section of your personal account.
| Property | Description |
|---|---|
| Label | The name of the block that is displayed in the script editor but is not used in the dialogue with the client. It is used for convenience when creating a script. |
| Marker | Conditional block designation, arbitrary text. Can be used in analytics in reports as a block completion marker — it can be used to track which blocks the robot has passed through. |
| Maximum cycles | The maximum number of times the robot can pass through a cycle. A cycle is considered to be when the user enters a specific block again. The maximum number of cycles is 100. |
The function parameters change depending on the value of the Function type field.
There are three types of functions available:
This type of function allows you to send requests to ChatGPT without connecting the assistant. It works similarly to the BPL function gpt.ask.
| Property | Description |
|---|---|
| Variable name for writing the answer | The name of the variable in which the neural network's answer will be recorded. Specified without curly brackets. Only letters, numbers, and the underscore symbol can be used in the name. The default value is answer |
| Model | The ChatGPT model to which the request will be sent. Acceptable models: gpt-4o, gpt-4o-mini. |
| Prompt | The request that will be sent to the neural network. Variables in the format {name} can be used in the request text. |
| Temperature | A number from 0 to 2 that determines the degree of reliability and variability of responses (0 is maximum reliability, 2 is maximum variability). |
| Use context | When this parameter is enabled, the history of the dialogue with GPT will be used to form subsequent responses, allowing for a coherent dialogue with the neural network. It is important to note that enabling this parameter may increase the number of tokens used by the query. |
| Maximum number of tokens | The maximum number of tokens in the neural network's response. If the parameter is disabled, or the value is less than or equal to zero, the limit does not apply. |
| Timeout | The time limit for executing the request in seconds. If the parameter is disabled, or the value is less than or equal to zero, the limit does not apply. |
This type of function allows you to initiate a chat session with an assistant, similar to the BPL function gpt.createThread.
When sending requests without the assistant's participation, there is no need to create a chat session.
| Property | Description |
|---|---|
| Thread ID variable | The name of the variable in which the thread ID will be stored. Only letters, numbers, and underscores can be used in the name. |
This type of function allows you to send requests to the ChatGPT assistant. It works similarly to the BPL function gpt.assist.
| Property | Description |
|---|---|
| Variable name for writing the answer | The name of the variable in which the neural network's answer will be recorded. Specified without curly brackets. Only letters, numbers, and underscores can be used in the name. The default value is answer |
| Assistant ID | Assistant ID from the AI Hub section of your personal account. |
| Thread ID | The ID of a previously created chat session, or a variable containing this ID. The variable name is specified in curly brackets. |
| Model | The ChatGPT model to which the request will be sent. Allowed models: gpt-4o, gpt-4o-mini. |
| Prompt | The request that will be sent to the neural network. Variables in the format {name} can be used in the request text. |
| Instruction | Instruction for the assistant that will be used instead of the main instruction from the AI Hub section. If this is not necessary, do not fill in the field. |
| Additional instruction | Additional instruction for the assistant that will be used instead of the additional instruction from the AI Hub section. If this is not necessary, do not fill in the field. |
| Temperature | A number from 0 to 2 that determines the degree of reliability and variability of responses (0 — maximum reliability, 2 — maximum variability). |
| Maximum number of tokens | The maximum number of tokens in the neural network's response. If the parameter is disabled, or the value is less than or equal to zero, the limit does not apply. |
| Timeout | The time limit for executing the request in seconds. If the parameter is disabled, or the value is less than or equal to zero, the limit does not apply. |
Using the BPL button in the Function section of the block parameters, you can convert the current block to a block with the Expression type. The block functionality will be preserved, and the block functions will be converted to BPL functions.