AI Action
Last updated
Was this helpful?
Last updated
Was this helpful?
AI Actions enable the execution of various predefined tasks as well as custom prompts. The action streams the model's output which is ideal since you don't have to wait for the entire response to display it.
The flow of creating an AI Action is similar to basic actions you create and run in UI Bakery. Let's review the details:
Create a new action and select the UI Bakery AI data source - the AI action step will be selected automatically.
Next, select the specific function you need from the Operation dropdown:
Generate - generates text based on the provided topic.
Summarize - summarizes the provided text.
Classify - classifies the provided text using specified classes.
Extract - extracts the information from the provided text using specified classes.
Chat - enables user/assistant communication.
Custom - allows specifying a custom prompt to perform any other AI task.
You can click Insert example above the Input field to understand the capabilities of these functions.
For example, the Extract operation searches for specified classes, such as name, address, city, etc. in the provided text and outputs the entries from the text.
(Optional) Specify any additional settings if necessary:
System message - instructs the model to behave in a specific way.
Temperature - defines the randomness of the model. The higher the value, the more random the output will be.
Click Execute action and check the Result tab.
Let's review an example of creating an app with UI Bakery AI Actions - specifically a simple but powerful address extraction application.
The flow is as follows:
Start by adding the following components to the working area:
Text Area - for users to insert their email or request.
JSON Viewer - to display the extracted data.
Button - to initiate the extraction process.
Next, create a new action and select the UI Bakery AI data source.
Select extract in the Operation dropdown and assign the value of the Text Area component as the user input, for example - {{ui.textArea.value}}
.
Additionally, define the classes you want to find in the Classes field. At this point, you can insert the user input and run the action to test it.
Now, to complete the setup, assign your action to the button's On Click trigger.
Finally, set the JSON Viewer's Value setting to the action's value variable - {{actions.extractValues.data}}
.
Type any text in the User input and click the Extract address details button to activate the action.
That's it! Now any time you'd want to extract the address details from the input, you'd simply need to click the button.
UI Bakery has a pre-configured Chat component. Thus, to develop a chat assistant app, you simply need to add this component to the working area - the AI Action will be created automatically and assigned to the chat's On Message Sent trigger.
All necessary properties will be also automatically connected to the action's settings. The Last user message and Messages history properties reference the properties of the Chat component.
Now, if you type a message in the chat and send it, you'll get the response there.
Additionally, you can also add Chat context through the System message. For example, you can use a Text Area component to provide context about UI Bakery. In real-world applications, this context may be retrieved from third-party resources, such as a database.