gpt.askSends a message to the ChatGPT neural network and returns its response.
Signature: gpt.ask(model string, text string, temperature float = 0.7, useContext bool = false, maxTokens int = 0, timeout int = 0) string
Arguments:
model — the name of the neural network model.text — a request to the neural network.temperature — a number from 0 to 1 that determines the degree of reliability and variability of responses (0 — maximum reliability, 1 — maximum variability).useContext — bool (true/false): Determines whether to use the previous conversation context. string (any string): The name of the custom variable that stores the context (conversation history).If the
useContextparameter is set totrueorfalsevia the Result block, the query may not work correctly, since all variables created outside of BPL are of typestringby default.
maxTokens — the maximum number of tokens in the neural network response (if greater than zero). If the value is less than or equal to zero, the restriction does not apply.timeout — the time limit for executing the request in seconds (if greater than zero). Maximum timeout is 30 seconds.Return value: Neural network response as a string.
Note:
If context is used (useContext = true), the current message is stored in the $“context.{MODEL}” variable list, and all previous messages will be passed to the request along with it.
If useContext = false, the current message is not added to the list.
The message list ($“context.{MODEL}”) is available for editing.
Example of use:
$answer = gpt.ask(“gpt-4o-mini”, “Is there life on Mars?”, 0.5, true, 500, 10) // $answer will contain the neural network's answer to the specified question.
gpt.askReasoningSends a message to the ChatGPT neural network and returns its response. It is used with reasoning models (for example, o1, o3, o4-mini, o3-mini, etc.).
Signature: gpt.askReasoning(model string, text string, effort string = 'medium', useContext bool = false, maxTokens int = 0, timeout int = 0) string
Arguments:
model is the name of the neural network model.text is a request to the neural network.effort — limits the cost of reasoning. Supported values are: low, medium, high.useContext — determines whether to use the previous conversation context.maxTokens is the maximum number of tokens in the neural network response (if greater than zero). If the value is less than or equal to zero, the restriction is not applied.timeout — the time limit for query execution in seconds (if greater than zero).Return value: The neural network response as a string.
Usage example:
$answer = gpt.askReasoning("o3-mini", "Is there life on Mars?", "medium", false, 500, 10)