React Server Components in AI Applications

Rate this content
Bookmark

FAQ

The main focus of Tejas Kumar's talk is the intersection of AI and React server components, and how AI can be used to enhance product experiences for React engineers.

The speaker is Tejas Kumar, an AI engineer at Datastacks with over 20 years of experience in web development. He has worked at companies like Mercel, Spotify, and Zeta.

An AI engineer is someone who interacts with APIs to leverage machine learning models, without needing to know machine learning or Python. They facilitate the use of AI in applications without training models themselves.

Tejas Kumar believes that UI is crucial for AI applications, as it provides the necessary interface for users to interact with AI functionalities, making AI usable and effective.

Tejas Kumar suggests using AI to generate UI components dynamically, using AI to enhance user interactions without solely relying on chatbots.

React server components allow for server-side rendering of components, enabling efficient integration of AI by generating virtual DOM on the server and sending it to the client.

Tejas Kumar acknowledges that people are tired of AI due to overhype, but emphasizes the importance of using AI rationally and effectively without falling into the trap of over-promising.

Tejas Kumar and his team developed a movie search application using React server components and AI to improve user experience by returning relevant movie suggestions.

Tejas Kumar compares AI to salt, suggesting it should be used sparingly to enhance product experiences rather than overwhelm them.

Tejas Kumar
Tejas Kumar
33 min
13 Dec, 2024

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Good morning, React Day Berlin! Today we'll discuss the intersection of AI and React server components. AI engineering is like salt for React developers, enhancing product experiences. Generative UI uses AI to generate text and code, and we'll build a React app using server components with generative UI. AI can improve movie search by inferring context, and we'll build a collaborative movie search project. Implementing AI search involves creating an AI context and setting UI state. We can enhance the UI by adding a system prompt and creating an AI agent for rich UI. The generate function acts as a generator for the virtual DOM. Memory functionality and interactive movie components can enhance the UI further. The future possibilities include AI-generated UI for e-commerce and personalized recommendations. React server components and the intersection of AI and UI are essential for UI engineers. AI SDK is MIT licensed and available for further discussions.

1. Introduction to AI and React

Short description:

Good morning, React Day Berlin! Thank you so much for having me. Today I'm an AI engineer at Datastacks, and we're going to talk about AI and specifically the intersection of AI and React server components. People are tired of AI, but for us as React developers and engineers, AI should be like salt. We sprinkle it on features to enhance product experiences. Let me define what an AI engineer is. It's not just about Python, machine learning, or linear algebra.

Good morning, React Day Berlin! Thank you so much for having me. I'm so excited to be here opening this conference in my city. So I live here and I've been speaking at this conference for so long. I was with the organizer backstage and he runs production and he showed me a photo from five years ago where we were together and he's like, look at the difference we've had over time. So it's such an honor and a privilege to be here with you today.

As mentioned, my name is Tejas, that's pronounced like contagious, and unfortunately I might actually be contagious, so I had a cold some few days ago and usually I say I'm not contagious, but honestly I don't know. I've been building on the web for over 20 years at various places like Mercel, Spotify, Zeta, and more, and I've been able to learn from some of the greatest minds. So anything you see today that is, you'd say, you know, good was learned by other people, okay? This is not a solo effort, definitely not. Today I'm an AI engineer at Datastacks, and the moment I say AI, I notice some of you go like, ah, and now they're AI.

And so here's the deal. We're going to talk about AI and specifically the intersection of AI and React server components, but like I mentioned AI, and the first thing I need to get out of the way before we go further is that honestly people are just tired of AI. Anyone tired of AI here? Anyone like, I'm tired of, yeah, like most of you. And this is fine. Like, I think there's a hype cycle that will show that this is the normal trend, and I'm here to give you not some hype, I'm not here to like channel Sundar Pichai from Google and be like AI, AI, AI, AI, you've seen the meme, AI, AI, AI, where he says like AI 121 times or something like this, which that's not a knock on him, I think they have some great AI innovations, but this is more than like investor promises, does that make sense? Like, I want to give us a reasonable and just a totally rational, balanced look at AI and what it actually means for us specifically as React engineers, okay?

To do that, let me just preface this point that people are tired of AI a little bit more. This is my friend Stephanie. She works at Igalia. They make browsers and they work on the JavaScript language specification. They literally make JavaScript. And she says that, she says, dear brands, companies, et cetera, I do not want or need AI injected into every single part of my life. Some of you feel this. At this rate, I'm more likely to use your product if you're not shoving AI down my throat. Okay, thanks, bye, right? There's research out of the University of Washington that proves, this came from a lab, it proves that if your product advertises AI a lot, people are less likely to sign up. That's where we are today. Okay?

So, so we are tired about it. And this is my thesis. Before we go further, I want to tell you that for us as React developers and engineers, AI really should be like salt. Like, like a little bit of salt. Like it's seasoning. We sprinkle it on features, we sprinkle it here and there, and we use it to enhance really great product experiences. And if we don't do that, just like with any salt, right, if we don't use salt appropriately, we might end up like killing someone. We might end up creating an unpleasant taste. So we've got to use it this way.

So at the beginning of this talk, I said I'm an AI engineer. And some of you went, oh my goodness, it's an AI engineer. What does that mean? I'm here to like, define this for you. Because a lot, I speak at a lot of conferences. This year, it's in the 30s. I've spoken at that many conferences. Out of 52 weeks in the year, that's like most of the year is spent speaking at things to people. Okay? And I ask people, hey, do you think you could identify as an AI engineer? Do you feel comfortable saying I could be, I maybe am, an AI engineer. If I ask you, any of you AI engineers or could be? Like one person. Confidence. I like it. We will fix this by defining what an AI engineer is. Because people, I ask them and they say, oh, I couldn't. No, I don't think so. Why? I don't know Python. I don't know machine learning. I didn't go to university. I'm not good at linear algebra.

2. AI Engineering and UI in React

Short description:

AI engineering is a piece of the full stack developer's stack, just like React. You don't need to know how to train a model, just how to make a network request. Andrej Karpathy, co-founder of OpenAI, defines AI engineering as making a fetch request to a model and solving a problem. UI is fundamental to AI, without a user interface, AI is useless.

I don't. The truth is you don't need any of that. Let's define this role and I will ask you again. This is the thesis, this is the document that defines what AI engineering is. This is latent space. It's a publication by my friend Sean Wang. Some of you know him as Swix. He defined the term AI engineer in this essay. And in it, this is how he defines it.

He says an AI engineer is here on the spectrum. You've got an API as a dividing line. And behind the API, you have machine learning research and engineering. These are the data scientists, the people who are training the models, who are making sure the models are performing well, the red teamers, everybody working on the models themselves. You've got a big API in the middle. Some of you have interacted with this API, the completions API from open AI or Anthropic. And behind the API, or rather, excuse me, in front of the API, you've got AI engineers, people who call an API that is in front of some model. And at the end, you have full stack engineers. AI engineering is really a piece of the stack of the full stack developer, just like React. A very crude way of saying this, and some of you may not like this, but it's just true, is that if you can make a fetch request in JavaScript to open AI's API and get an inference from GPT-3 or 4, then you can be an AI and you probably are an AI. That's what AI engineering is, making a fetch request to a model and getting a response and solving a problem with And you may think, Tejas, that's nonsense. You don't know what you're talking about. Look, this is by people smarter than me. Sean is extremely smart. He actually called the AI wave. But I want you to pay attention to the bottom of this. Look at this quote. It says, in numbers, there's probably going to be significantly more AI engineers than there are machine learning engineers or large language model engineers. One can be quite successful in this role. Pay attention. What does it say? Without ever training anything. That's a big deal. You don't have to know how to train a model. You just have to know how to talk to one, how to make a network request. And who's saying this? Anyone know this name? Andrej Karpathy is a co-founder of OpenAI. He built chat-GPT. He literally is the guy in machine learning, data science and AI engineering. He was formerly, I think, VP of self-driving at Tesla. The dude's been in machine learning and AI for a long time. So when someone like this defines AI engineering like that and continues to do so, it means something. So if I ask you again, could you be maybe an AI engineer, I expect there to be a different answer. Yeah, many of you. That's why I'm here today. I want to make this accessible to as many of you as possible because you are included in this space. There's much room at the table and I want you to be able to play this. But here's the thing.

We work with React. We are UI engineers. And I want to spend some of our time talking about this because the UI is so fundamental to AI that I would even say that without UI, AI is kind of useless. In fact, without UI, and we're defining UI as a user interface to something, anything is useless. Does that make sense? Do you like food? So if you like food and you see food, without a user interface to your food, a fork, a mouth, it's useless.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building a Voice-Enabled AI Assistant With Javascript
JSNation 2023JSNation 2023
21 min
Building a Voice-Enabled AI Assistant With Javascript
Top Content
This Talk discusses building a voice-activated AI assistant using web APIs and JavaScript. It covers using the Web Speech API for speech recognition and the speech synthesis API for text to speech. The speaker demonstrates how to communicate with the Open AI API and handle the response. The Talk also explores enabling speech recognition and addressing the user. The speaker concludes by mentioning the possibility of creating a product out of the project and using Tauri for native desktop-like experiences.
AI and Web Development: Hype or Reality
JSNation 2023JSNation 2023
24 min
AI and Web Development: Hype or Reality
Top Content
This talk explores the use of AI in web development, including tools like GitHub Copilot and Fig for CLI commands. AI can generate boilerplate code, provide context-aware solutions, and generate dummy data. It can also assist with CSS selectors and regexes, and be integrated into applications. AI is used to enhance the podcast experience by transcribing episodes and providing JSON data. The talk also discusses formatting AI output, crafting requests, and analyzing embeddings for similarity.
The Rise of the AI Engineer
React Summit US 2023React Summit US 2023
30 min
The Rise of the AI Engineer
Watch video: The Rise of the AI Engineer
The rise of AI engineers is driven by the demand for AI and the emergence of ML research and engineering organizations. Start-ups are leveraging AI through APIs, resulting in a time-to-market advantage. The future of AI engineering holds promising results, with a focus on AI UX and the role of AI agents. Equity in AI and the central problems of AI engineering require collective efforts to address. The day-to-day life of an AI engineer involves working on products or infrastructure and dealing with specialties and tools specific to the field.
The Ai-Assisted Developer Workflow: Build Faster and Smarter Today
JSNation US 2024JSNation US 2024
31 min
The Ai-Assisted Developer Workflow: Build Faster and Smarter Today
AI is transforming software engineering by using agents to help with coding. Agents can autonomously complete tasks and make decisions based on data. Collaborative AI and automation are opening new possibilities in code generation. Bolt is a powerful tool for troubleshooting, bug fixing, and authentication. Code generation tools like Copilot and Cursor provide support for selecting models and codebase awareness. Cline is a useful extension for website inspection and testing. Guidelines for coding with agents include defining requirements, choosing the right model, and frequent testing. Clear and concise instructions are crucial in AI-generated code. Experienced engineers are still necessary in understanding architecture and problem-solving. Energy consumption insights and sustainability are discussed in the Talk.
Web Apps of the Future With Web AI
JSNation 2024JSNation 2024
32 min
Web Apps of the Future With Web AI
Web AI in JavaScript allows for running machine learning models client-side in a web browser, offering advantages such as privacy, offline capabilities, low latency, and cost savings. Various AI models can be used for tasks like background blur, text toxicity detection, 3D data extraction, face mesh recognition, hand tracking, pose detection, and body segmentation. JavaScript libraries like MediaPipe LLM inference API and Visual Blocks facilitate the use of AI models. Web AI is in its early stages but has the potential to revolutionize web experiences and improve accessibility.
Code coverage with AI
TestJS Summit 2023TestJS Summit 2023
8 min
Code coverage with AI
Codium is a generative AI assistant for software development that offers code explanation, test generation, and collaboration features. It can generate tests for a GraphQL API in VS Code, improve code coverage, and even document tests. Codium allows analyzing specific code lines, generating tests based on existing ones, and answering code-related questions. It can also provide suggestions for code improvement, help with code refactoring, and assist with writing commit messages.

Workshops on related topic

AI on Demand: Serverless AI
DevOps.js Conf 2024DevOps.js Conf 2024
163 min
AI on Demand: Serverless AI
Top Content
Featured WorkshopFree
Nathan Disidore
Nathan Disidore
In this workshop, we discuss the merits of serverless architecture and how it can be applied to the AI space. We'll explore options around building serverless RAG applications for a more lambda-esque approach to AI. Next, we'll get hands on and build a sample CRUD app that allows you to store information and query it using an LLM with Workers AI, Vectorize, D1, and Cloudflare Workers.
AI for React Developers
React Advanced 2024React Advanced 2024
142 min
AI for React Developers
Featured Workshop
Eve Porcello
Eve Porcello
Knowledge of AI tooling is critical for future-proofing the careers of React developers, and the Vercel suite of AI tools is an approachable on-ramp. In this course, we’ll take a closer look at the Vercel AI SDK and how this can help React developers build streaming interfaces with JavaScript and Next.js. We’ll also incorporate additional 3rd party APIs to build and deploy a music visualization app.
Topics:- Creating a React Project with Next.js- Choosing a LLM- Customizing Streaming Interfaces- Building Routes- Creating and Generating Components - Using Hooks (useChat, useCompletion, useActions, etc)
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
JSNation 2024JSNation 2024
108 min
Leveraging LLMs to Build Intuitive AI Experiences With JavaScript
Featured Workshop
Roy Derks
Shivay Lamba
2 authors
Today every developer is using LLMs in different forms and shapes, from ChatGPT to code assistants like GitHub CoPilot. Following this, lots of products have introduced embedded AI capabilities, and in this workshop we will make LLMs understandable for web developers. And we'll get into coding your own AI-driven application. No prior experience in working with LLMs or machine learning is needed. Instead, we'll use web technologies such as JavaScript, React which you already know and love while also learning about some new libraries like OpenAI, Transformers.js
Llms Workshop: What They Are and How to Leverage Them
React Summit 2024React Summit 2024
66 min
Llms Workshop: What They Are and How to Leverage Them
Featured Workshop
Nathan Marrs
Haris Rozajac
2 authors
Join Nathan in this hands-on session where you will first learn at a high level what large language models (LLMs) are and how they work. Then dive into an interactive coding exercise where you will implement LLM functionality into a basic example application. During this exercise you will get a feel for key skills for working with LLMs in your own applications such as prompt engineering and exposure to OpenAI's API.
After this session you will have insights around what LLMs are and how they can practically be used to improve your own applications.
Table of contents: - Interactive demo implementing basic LLM powered features in a demo app- Discuss how to decide where to leverage LLMs in a product- Lessons learned around integrating with OpenAI / overview of OpenAI API- Best practices for prompt engineering- Common challenges specific to React (state management :D / good UX practices)
Working With OpenAI and Prompt Engineering for React Developers
React Advanced 2023React Advanced 2023
98 min
Working With OpenAI and Prompt Engineering for React Developers
Top Content
Workshop
Richard Moss
Richard Moss
In this workshop we'll take a tour of applied AI from the perspective of front end developers, zooming in on the emerging best practices when it comes to working with LLMs to build great products. This workshop is based on learnings from working with the OpenAI API from its debut last November to build out a working MVP which became PowerModeAI (A customer facing ideation and slide creation tool).
In the workshop they'll be a mix of presentation and hands on exercises to cover topics including:
- GPT fundamentals- Pitfalls of LLMs- Prompt engineering best practices and techniques- Using the playground effectively- Installing and configuring the OpenAI SDK- Approaches to working with the API and prompt management- Implementing the API to build an AI powered customer facing application- Fine tuning and embeddings- Emerging best practice on LLMOps
Building AI Applications for the Web
React Day Berlin 2023React Day Berlin 2023
98 min
Building AI Applications for the Web
Workshop
Roy Derks
Roy Derks
Today every developer is using LLMs in different forms and shapes. Lots of products have introduced embedded AI capabilities, and in this workshop you’ll learn how to build your own AI application. No experience in building LLMs or machine learning is needed. Instead, we’ll use web technologies such as JavaScript, React and GraphQL which you already know and love.