Tasks
GPT Call
The GPT Call task does a simple call to an external AI assistant provider (openai, groq, deepinfra etc.). It does not have any of the normal Stubber functionalities included in the GPT Chat Task task. It is a simple call to the provider and returns the response.
The task params
is forwarded exactly to the provider (with the exception of the model name), so the provider's API documentation should be consulted for the correct parameters.
Use cases
- Quickly call out to a different model to sanity check the response of an active chat.
Basic usage
Parameters
Only required parameters
are mentioned here. Please consult the relevant AI provider's API documentation for the correct parameters. Most platforms use the common openai
format.
required string
model The model that the task should use to do this specific instance of chat completion. Common models to use are:
gpt-4o-mini
: Fast but expensive, but at the cost of reasoning capabilities.gpt-4
: Slower thangpt-4o-mini
, with better reasoning capabilities.gpt-4-turbo
: State of the art model, large context window, fast, good reasoning capabilities, better instruction following, JSON mode and more.gpt-4o
: State of the art model, omnichannel, large context window, fast, good reasoning capabilities, better instruction following, JSON mode and more.
See Models for a full list of supported models.
Default: null
required array
messages The messages to submit for a chat completion. It is an array of objects in which each object takes the structure {"role": {{role}}, "content": {{content}}}
, where role
can be one of system
, user
and assistant
, and content
is the string value of the message text. The messages in the array should be sorted ascending chronologically, meaning that the message at the first index in the array should be the earliest message, and the last message in the array should be the latest.
Each chat has an array of messages that is automatically handled by the Stubber system. When there is a back and forth discussion between an assistant and a user, the messages are appended to this array, unless the message_operation
is set
, then the messages are overwritten by the messages of the current task.
Default: []
Result
Properties
integer
response The response from the AI provider.
string
response.message We make the response message available at this path for easy access. The general real path a message is available at is response.choices[0].message
.
Examples
JSON format
Get the response in JSON format. A response in JSON format is useful when you want to parse the response and use it in a programmatic way.
The system prompt has to contain the string json
to get the response in JSON format.
Result: