AI
Asks a Claude, ChatGPT or Gemini model and saves the answer in a variable. The step writes nothing to the person itself: the next step can show the answer through a token.
When to use it
- Answer a person's free-form question.
- Work out what the person wants and take the right branch.
- Pull a name, an address or an order out of a text as JSON.
How to set it up
-
API key. The step asks the model with your key, so you pay the provider for the requests directly. Add the key in "Settings → Secrets" under this name:
ANTHROPIC_API_KEYfor Claude,OPENAI_API_KEYfor ChatGPT,GEMINI_API_KEYfor Gemini. While there is no key, the step's form warns about it. - Ask. Pick the provider and the model. With no model picked, the step asks the provider's default one. You can type the name of any model the provider knows.
- Question. The text for the model. Tokens are filled with the variables' values.
- How to answer. Optional instructions for the model: a role, a tone, rules. Tokens work here too.
- While it thinks. A message the person sees at once while the model thinks. The bot's next message takes its place: the answer or the message of the error branch. A new step has 🤔 here, and Telegram shows a lone emoji large and animated. An empty field sends nothing, only "typing…".
- Memory. How many of the last messages of the person and the bot the model sees before the question, up to 50. They can be limited to a number of hours: older messages are then left out. This way the model remembers what the conversation was about. 0 is no memory: the model sees every question as the first one.
- Save to. The variable for the answer, with its format next to it: "as text" or "as JSON". JSON is saved as an object, and its fields can be read one by one.
The variable's name decides how a text answer is saved. When it ends in _html, like answer_html in a new step, the answer keeps Telegram formatting: bold, italics, lists, links and code. Its token in a message shows the answer as the model formatted it. Any other variable gets plain text, without formatting marks: easier to compare in a condition.
Important
While the model thinks, the person sees "typing…". The model has up to 60 seconds to answer.
If the request fails, the dialog takes the "The model did not answer" branch. That happens when there is no key, the provider returns an error, the model does not answer within 60 seconds, the answer is empty or the JSON cannot be parsed. Without that branch the person gets a message that something went wrong, and you get the reason.
The step does not repeat a failed request.