Use the AI blocks to craft your AI-powered chat service

Neelke Stadler Updated by Neelke Stadler

Our AI blocks provide maximum flexibility to craft your AI-powered service, without the unnecessary complexity of dealing with OpenAI APIs.

Once you have your AI integration set up successfully and provided relevant information for your AI assistant, it is time to build AI-power chat service using journeys on Turn.

On the Journeys page you will find a suite of 6 AI blocks you can use to craft your chat service. These make it super easy to add AI to your journeys. And if you ever want to see the code that powers them, just click on the </> button on the top right.

This 7 minute video will show you how to use the blocks, and if you continue to scroll down we unpack the blocks one at a time.

Warning: LLM's are non-deterministic. This means that given the same input, they don't always result in the same output. That can lead to unexpected results. When this happens, we suggest experimenting with different instructions — for example, making them more specific.

The different type of AI blocks

There are 6 AI-powered blocks, Let's go through them one by one.

  • Generate text
  • Answer a question
  • Classify text
  • Classify image
  • Text to voice
  • Voice to text

Let's unpack the what each block is designed to do and how to use them best!

Generate text

Your typical ChatGPT experience: tell AI what to generate, and it’ll do it for you.

The true power of this block is when you combine it with other blocks. You can see in the example above that we:

  1. Ask the user their name in a block called Name
  2. Reference the results in the Generate text instructions by typing @ref_Name
Tip: always prefix the name of a block with ref_ to reference it

Alternatively, you can also either type @ or click the @ button to reference both the last message the user sent, or any variable you have available on your Journey:

Note: by default this block responds to the user with the generated text, but if you for some reason want to use the response in another block first, you can toggle that setting off.

Here are a few Playbooks that make use of this block:

Answer a question

This block is perfect for when you want to use AI to answer user's question. It does 3 things at once:

  1. Asks the user a question (which you can configure on the 1st text field in the block)
  2. Generates an answer
  3. Replies to the user with the answer

Here are a few Playbooks that make use of this block:

Classify text

Uses AI to determine the intent in a piece of text, and allows you to branch your journey based on the result. Here's a simple example that determines if someone is trying to speak with a person or ask a question:

This block becomes very powerful if you combine it with other blocks, such as the Generate text. You can build a natural, fully AI-powered conversation (that ends when the person has no more questions):

Here are a few Playbooks that make use of this block:

Classify image

Similar to the above, but helps you branch your journey based on the last image the user has sent you. Useful for scenarios, for example, checking the photo of a covid test and helping the user determine if it’s positive or negative:

We suggest using a Question block before, which pauses the journey until user's reply (hopefully with an image). If no image is found, you can deal with that using the the last option: Image not found .

Text to voice

Use AI to convert any text to voice. As you can see in the example below, you can pass any variables or profile fields into it:

Here are a few Playbooks that make use of this block:

Voice to text

Will convert the user's last voice message into text. Here's how it works:

We suggest using a Question block before, which pauses the journey until user's reply (hopefully with a voice note). If no audio is found, you can deal with that by branching the journey using the Audio not found option.

If you combine the Text to voice and the Voice to text blocks, you can build a fully voice-powered service:

What if I want to code my journeys?

All of these blocks are powered by code. You can see how they work by clicking on the Show Code button on the top-right:

You can also find more information and examples about how to use AI in code in our developer docs.

We're looking forward to see what you build!

Was this article helpful?

How to provide relevant contextual information for your AI assistant

How to best use the GenAI Playbooks

Contact