Setting Up UI2
Set up everything you need to use UI2
Let's start by installing UI2, available on NPM or your favorite package manager.
For this guide, we can use either TypeScript or JavaScript. Howevever, UI2 is built from the ground up for TS, so feel free to try it out!
You'll also need a few other dependencies through this guide:
Now, simply import createUI2
, and call it for now. This is how we'll be building our UI2 app today.
We'll discuss the identifyIntent
more later. However, for now, just know this is how you'll be actually identifying intent from text.
Next, in the configuration object, we need to put a model
. These are available through the Vercel AI SDK.
It is highly recommended that you use the Cerebras models for their speed. Learn how to set it up on the Vercel AI SDK Website.
Structured Output
UI2 uses Structured Output to guarentee that your Intent parameter schemas are
satisfied. Your model has to support this feature. llama-3.3-70b
from
Cerebras works great.
After you have your model set up, it should look something like this:
In order to run your app, you can either compile it if you're using TypeScript, or simply run it with Node.js if you're using JS:
Now, let's move on to creating some intents!