OpenAI Assistants Integration

Once you've added an OpenAI API Key to your Flowrabbit project, you're ready to use OpenAI Assistants in your application! You can learn how to add an OpenAI API Key in this chapter: OpenAI Integration Overview

What is Flowrabbit's OpenAI Assistant Integration?

Flowrabbit preintegrates a widget that you can use to add OpenAI Assistants to your application. This makes it easier to build applications with the power of OpenAI's services. You can easily create smart, AI-supported applications that utilize your custom OpenAI Assistants. This way, they know exactly the context you want them to work in, and you can leverage all the features of OpenAI Assistants, such as retrieval of information from files, for your Flowrabbit applications. Browse OpenAI's documentation to learn more about Assistants.

How do I use OpenAI Assistants in my Flowrabbit Application?

To use OpenAI Assistants in your Flowrabbit application, follow these steps:

  1. Click on the Widget Button in the topbar (cloud icon) and choose "Assistant"
  2. Place your Assistant Widget on the canvas. Do not place it on a screen. We suggest placing it somewhere near the screen that is relevant to the Assistant, for example, the screen that will show results that the Assistant generates.
  3. Double-click on the Assistant Widget to open its settings.
  4. In the "Auth Token" dropdown, choose the name of your OpenAI API Key in this application's settings. This is the name you entered when you added your key in the application settings.
  5. Select the Assistant you want to use for this Widget. The name you select here is the name you have given to the Assistant when you created it in your OpenAI API Profile.
  6. Select the Input Variable. This should be the output variable of the prompt builder you have (or will) connect to this Assistant Widget. Learn how to create prompt builders below.
  7. Select the Output Variable. This is where the generated result of the Assistant will be shown. Usually, this would be some sort of text component; an "Animated Label" Component can be used for the "typing" effect when the result is being displayed.
  8. In the "Test" tab, you can manually enter a prompt to test out your Assistant Widget.
  9. Click "Ok"
  10. Now you need to connect your assistant widget to a prompt builder and the screen on which the results should be displayed. Enter the "Data & Logic"-View, connect the Prompt Builder to the Assistant, connect the Assistant to the screen with the results.

Have a look at a Demo of how to add a Assistant Widget to a Flowrabbit Application:

How do I use Prompt Builders for my Assistants? 

A prompt builder is a Widget that you can use to assemble a prompt using data (e.g., user input) from your application. This prompt can then be used with Assistants, enabling you to create AI-supported applications.

To create a prompt builder, follow these steps:

  1. Click on the Widget Button in the topbar (cloud icon) and choose "Prompt Builder"
  2. Place the Prompt Builder on the canvas. Do not place it on a screen. We suggest placing it near the screens (and Assistant Widgets) it will be relevant to.
  3. Double click on the prompt builder to open its settings.
  4. Enter the prompt. Create the prompt as you would when using ChatGPT or an Assistant in the OpenAI Playground. To use data from your application in the prompt, use this notation: ${data_binding}. For example, in a Book Recommendation App, you might ask the user to choose the number of pages the recommended book should have using a slider; you should give the slider a Data Binding (variable name), this might be "pages." To use the number of pages the user chose in the prompt builder, you could write something like, "Recommend a book that is around ${pages} long."
  5. Give the Output Variable a name. Something like "prompt" might make sense since this is the variable you will use as input in the Assistant Widget.
  6. Click "Ok."
  7. Enter the "Data & Logic" View by clicking the button in the topbar (database icon on smaller screens).
  8. Connect the component that should cause the Prompt Builder to start building its prompt to the Prompt Builder. Usually, this is the component, e.g., a Button, that starts the generation of a result.
  9. If you have not created an Assistant yet, follow the steps above. Then connect the Prompt Builder to the Assistant.

Tip: When creating an application with a prompt builder and assistant, a successful connection in the "Data & Logic" View might look like this: Element starting Generation (e.g., Button) -> Prompt Builder -> OpenAI Assistant -> Result Screen."

Was this article helpful?

OpenAI Integration Overview
OpenAI GPT Integration