How to build Flows?
Last updated
Last updated
Building a Flow is straightforward. Let's explore the process by creating a simple Flow where an input is fed into an LLM to generate a response.
Go to the ‘Flows’ section, and click the ‘+New Flow’ button.
You will be directed to the ‘Build’ page, where you can start building the Flow.
On the ‘Build’ page, the first component is a default text input. To change the input action, click on the input component’s box. A side screen will appear, allowing you to select the appropriate input type from the Action dropdown menu. For this example, we will choose a text input.
Then click on the ‘+' button below the input component. Navigate to the side screen, enter “ZBrain model” in the search field, and click on it.
Choose an ‘Action’ for the model to perform. This Action can include tasks such as generating images, transcribing audio, converting text to audio recordings, and more. In this case, we will select the 'Ask LLM' action.
Now, navigate to ‘Connection’ and click on ‘+New Connection.
Here, provide a name for the connection and enter your API key. Follow the on-screen instructions to locate your OpenAI API Key and input it into the designated field. You can also find your ZBrain API key under Settings -> My Account. Finally, click the ‘Save’ button to proceed.
Next, choose a suitable model, enter a question, and configure other additional parameters based on your specific needs.
Click the '+' button again, then type "response" in the search bar. From the search results, select the 'HTTP' option.
Once the side screen appears, choose the action you want the component to perform. Here, select the ‘Return Response' option.
A response box will appear where you can define the data returned by your Flow. Paste the following code snippet into the box:
Here, step_2
represents the result of the second step. Modify this value as needed depending on which step's response you require.
Your final Flow is now complete. Click the ‘Save’ button to store your changes.
Testing each step in the Flow involves validating each component’s functionality to ensure it operates as expected. Once a component is tested, you will be provided with sample data. The generated sample data can then be used to validate and refine subsequent steps, contributing to the overall development and reliability of your Flow application.
Here’s how to test each step:
Select the component you wish to test. In this case, we are selecting the second component of the Flow, labeled as ‘Ask LLM’.
Click the play button located at the top right corner of the side screen.
Next, on the 'Generate Sample Data' screen that appears, click the ‘Test step’ button.
The sample data will be generated successfully. Repeat the same step to test each component.