And it's not the way you think!
This talk has been presented at React Summit US 2024, check out the latest edition of this React Conference.
And it's not the way you think!
This talk has been presented at React Summit US 2024, check out the latest edition of this React Conference.
Yes, the AI setup can be extended to perform mutations such as adding items to a cart, by allowing the AI to interact with data and perform actions based on user inputs and tool functions.
TanStack React is a framework used in the demonstration to build a React app that interacts with AI models, allowing for live coding and creating dynamic UI elements based on AI interactions.
Zod is used to define the schema of data that the AI tools will handle, ensuring the structure of data being processed is consistent and reliable, which aids in managing how responses are structured.
AI tools are used in UI development to revolutionize how interfaces are created and managed, allowing AI to interact with data, make UI decisions, and provide a more customized user experience.
Tools allow AI to access and manipulate data, make multiple requests, and manage the UI dynamically, enabling it to perform tasks such as fetching data, filtering results, and presenting information effectively.
Local LLMs like OLama can be integrated by directly connecting them to the system via API calls, allowing them to perform similar tasks as cloud-based models but running locally to avoid vendor costs.
VectorDB and embeddings facilitate efficient data retrieval and processing, allowing AI to quickly search and use relevant data, which enhances the speed and accuracy of AI's responses and interactions.
RAG stands for Retieval Augmented Generation, a method used to provide AI with data context by retrieving relevant information from a database to generate a more informed response.
The AI uses a JSON database of video games and a tool to fetch data based on user queries, allowing it to provide tailored video game recommendations by interacting with the backend and using RAG.
AI will revolutionize UI through the use of tools. We're going to give our AI tools and start with a TanStack React app. It's going to talk to our LLM and connect to our data. We're going to allow it to use tools to pick what kind of UI we want to show. Now let's see how easy it is to implement a React chatbot in Start.
So, AI will revolutionize UI through the use of tools. And when I talk about tools, I was talking to a few people about it, and they're like, oh, you mean like Copilot or Cursor? Nope, not that. Like V0 or Leonardo or Midjourney? Nope, not that. So, what we're going to do is we're going to give our AI tools. So, we're going to start with a TanStack React app. I'm going to do this live coding. Wish me luck. Yeah.
And our TanStack React app, if you made this first time you've seen TanStack start, it's been exciting on that face alone. It's going to talk to our LLM. In this case, it's going to talk to OpenAI. And then we're going to use a tool, a set of tools, and we're going to give it a tool to connect to our data. So, it's going to have our data in it, which is really cool. But more importantly, I think, at the end, we're going to actually allow it to use tools to pick what kind of UI we want to show. So, this is what you're going to see by the end of all this. So, all right.
So, now we've all kind of seen in the past a React chatbot. So, let's see how easy it is to actually implement this in Start. All right. Can you see the code? Can you see my dog? Hey, Murph. All right. Come here, you. There we go. I'm working on two different screens. So, this is like... Okay. So, I'm going to use a little bit of cheat code here. I'm going to give myself some... There we go. So, the first thing I'm going to do is I'm going to bring in AI React.
Versal's AI library called React works with TAN stack and manages the UI, handles input change, and submits to the AI endpoint. We can use ShazCN's input. We will build a recommendation system for video games using the games.json data. We will connect it with the backend using open AI and provide a system prompt.
So, Versal has an AI library called React. It actually works with other things other than Next.js. Now, it also works with TAN stack. And what it's going to do is manage the UI for us. So, it's going to give us messages. That's a transcript of our conversation with the AI, the input field, and the handle input change. So, the on change handler for the input, and then handle submit. And that's actually going to submit back to our AI endpoint. So, let's go and change the JSX. So, we actually use it.
All right. Now, we're going to bring in ShazCN's input. Anybody like ShazCN? Well, yeah. That also works with it. So, that's cool. Let's take a look. All right. So, now we got some things right here. Now, what we're going to do is we're going to build a recommendation for video games. So, we are a video game selling company. And we got a list of all the video games that we actually want to show, so, that we want to give to our customer. So, let me bring up that. Over here, we got games.json.
So, eventually, at the end of all this, we're going to allow the customer to get recommendations about the games that we have. So, that's really what we're, you know, the difference between this and a kind of stock UI. Okay. So, the next thing we want to do is actually connect this with the backend. So, we're going to connect it with our open AI. So, we're going to bring in open AI. And then we're going to give it a system prompt.
Comments