back to indexBuilding Reactive AI Apps: Matt Welsh

Chapters
0:0 Intro
2:9 AIJSX
4:13 AIJSX Features
6:40 TreeBased Structure
8:32 KidsSafe Component
11:12 Floating Embed Component
00:00:30.000 |
We're going to, you know, the AI models are not perfect yet, 00:00:39.720 |
about what we've been working on at Fixie for a while, 00:00:42.680 |
which is an open source framework for building 00:00:45.140 |
what we call reactive AI applications called AI.jsx. 00:00:53.180 |
First of all, what's the problem we're trying to solve? 00:00:54.860 |
Well, I think most of us here know this already, 00:00:57.880 |
but building and deploying high-quality LLM apps 00:01:03.960 |
It's a lot of pieces you've got to worry about. 00:01:05.600 |
You've got your vector databases, your context window limits, 00:01:09.460 |
your rag stack, your tool sets, all that stuff. 00:01:12.820 |
Now, most of us in this room enjoy solving those problems. 00:01:18.000 |
But we think most developers probably would rather not 00:01:26.720 |
So at Fixie, we are aiming to solve this problem 00:01:29.960 |
by inventing the future of AI application development. 00:01:38.800 |
that I think everyone here will agree is the most revolutionary 00:01:54.960 |
And so, ladies and gentlemen, may I introduce to you 00:02:20.940 |
So this is AI JSX, and I'm going to talk about this a bit. 00:02:35.260 |
you might be wondering why TypeScript, right? 00:02:38.280 |
Well, we believe that there are many front end and full stack 00:02:42.160 |
devs that are just-- they don't have good tools 00:02:49.540 |
But we also think that the AI devs, the front end devs, 00:02:53.520 |
are the ones building the AI experiences of the future. 00:02:57.540 |
But today they're kind of like that bear staring in the window, 00:03:00.540 |
They're saying, hey, we want a piece of the action. 00:03:04.700 |
But it's all the Python devs that are in the back end 00:03:09.200 |
So why should the Python devs have all the fun? 00:03:11.860 |
There's also a lot more JavaScript developers in the world 00:03:16.300 |
So we think that helping this community that hasn't been well 00:03:23.200 |
So without AI JSX, this is what an AI engineer looks like today. 00:03:28.200 |
I think I met that guy out in the hall yesterday. 00:03:31.860 |
But with AI JSX, we can all be Hacker Man or Hacker Woman. 00:03:39.700 |
I'm going to rock you with this whole presentation on this. 00:03:47.820 |
What we're doing here is defining a complete application 00:03:54.980 |
That's the foundation of anything that might call into an LLM. 00:03:59.700 |
And we're providing it a user message prompt in the form 00:04:03.400 |
of write a Shakespearean sonnet about large language models. 00:04:16.060 |
But let's talk a little bit about what AI JSX is. 00:04:19.360 |
Think about it like React, but for building LLM apps. 00:04:26.600 |
that we actually have a page on our documentation site 00:04:33.360 |
But clearly that's wrong because here I am telling you it is. 00:04:40.200 |
which means you get all the safety and performance of JavaScript 00:04:43.780 |
with the exciting adventure of fucking around with your dev tooling. 00:04:49.040 |
Any model, any provider, we can support both Anthropic and open AI. 00:04:58.620 |
This is great for building full stack applications 00:05:01.180 |
where you just want to drop your AI powered stuff into your React app. 00:05:14.540 |
You can use it to invoke custom tools and APIs, 00:05:18.320 |
so you can use AI JSX in situations where you want to invoke an external service or an API. 00:05:24.280 |
One of the cool features of AI JSX is the ability to have the AI generate UI components for you. 00:05:32.240 |
Because the AI JSX program is operating on effectively the DOM, if you will, as React components, 00:05:42.860 |
And, of course, it's fully programmable and extensible, so you can basically build whatever you want. 00:05:48.440 |
I'm going to give you a whirlwind tour of all this, show you what's possible. 00:05:53.700 |
Basic idea is you build components, just like you do in React. 00:05:58.440 |
Here, I'm defining a component called makeSetting. 00:06:01.020 |
I might define a setting for a story that we might want to write. 00:06:04.320 |
And this component takes in its children elements as a parameter. 00:06:10.580 |
And we basically say write a one-paragraph description of this setting 00:06:20.060 |
They can be a string or they can be the result of a different tree of JSX nodes 00:06:26.480 |
that have been rendered and placed in line in that prompt. 00:06:31.600 |
So to call it, all I need to do is say, take the makeSetting component, instantiate it, 00:06:43.320 |
But you might be saying to yourself, come on, this is basically writing Python code 00:06:50.740 |
This is, the angle brackets are a little bit overplayed here. 00:06:58.700 |
JSX defines an entire tree of nodes that are rendered as a stream asynchronously and in parallel. 00:07:07.020 |
So instead of rendering to the DOM like React does, we're rendering effectively to the LLM, if you will. 00:07:16.620 |
So this allows us to do extremely powerful forms of composition. 00:07:20.620 |
So here's a simple example of writing a story where I have a makeStory component with three child components. 00:07:28.060 |
One is defining the character, another is defining the setting, and a third is defining the plot. 00:07:35.740 |
When we render this application, all three of those components are going to run in parallel, and they're all streaming in parallel. 00:07:45.580 |
There's three concurrent LLM calls going on, and they're streaming their tokens back to the makeStory component in real time. 00:07:55.180 |
And so as this is being rendered, all the tokens are streaming through. 00:08:00.620 |
The makeStory component is then streaming its output out to the result of that render, which might result in a story that looks like this. 00:08:08.060 |
So far, I'm just showing you some basic things with text to give you some intuition around the ideas. 00:08:13.060 |
But of course, you can take this a lot further. 00:08:17.260 |
One thing you might say about this tree-based structure in AIJSX is that it allows you to break free of your chains. 00:08:30.740 |
Okay, so here's another example of what you might be able to do. 00:08:37.380 |
Let's wrap one component in another in order to constrain the latter component's output. 00:08:42.740 |
So we're going to define a KidSafe component. 00:08:45.220 |
This component takes in a system message that says, rewrite the following text so it's safe for kids. 00:08:51.140 |
And the child components of that component are placed into the user message of that prompt. 00:08:59.580 |
Then when we just wrap any component we want in a KidSafe component, it automatically will rewrite the output to be KidSafe. 00:09:09.980 |
Let me show you a quick example of how you use AIJSX to call out to tools and third-party APIs. 00:09:17.500 |
In this case, we're going to define a record, which is a set of tools that we want to give the LLM access to. 00:09:26.580 |
Remember, this is a tool that calls the GitHub GraphQL API. 00:09:31.140 |
And we're going to give it an English description of the tool. 00:09:37.840 |
I've taken out the code for the JavaScript function because that's not interesting for this talk. 00:09:41.720 |
But that's just calling using the Fetch API to call the GraphQL endpoint at GitHub. 00:09:48.480 |
To use the tool in an application, then, all I have to do is instantiate a useTools component, give it that set of tools, and then anything that might need to use those tools as part of the rendering process can now invoke them. 00:10:03.640 |
And so I can build very powerful applications in this way. 00:10:06.760 |
This is RAG, retrieval augmented generation, in something like 10 lines of code. 00:10:17.400 |
There's two children of that, the system message and the user message. 00:10:20.980 |
The system message says, use the following information to answer the user's query. 00:10:25.700 |
And it gets that information by using a DocsQA component. 00:10:30.980 |
The DocsQA component is configured with a corpus of documents that you've crawled and indexed and placed in a vector database. 00:10:37.760 |
You provide the user's query, the DocsQA component returns the chunks that are relevant to that query, places them right there in the system message, and then the user message contains the query again, and the final result is you effectively have retrieval augmented generation. 00:10:57.260 |
I think this is a lot easier to understand, it's a lot easier to manipulate, it's a lot easier to integrate with other applications when expressed this way, 00:11:06.440 |
rather than have a whole lot of different libraries that you have to invoke. 00:11:10.240 |
And finally, when you're done building an AI-JSX application and you want to place it into your website, or your web app, or your mobile app, or whatever it is, 00:11:22.380 |
you can just drop it right in as a React component. 00:11:25.420 |
So in this case, we're showing you use the floating fixie embed component, that when you instantiate this, gives you a fully rendered UI 00:11:35.560 |
UI for your AI-JSX application, with a chat window, with session management, markdown, rendering, custom UI, all the things that you might want out of such a thing in effectively one line of code. 00:11:54.240 |
So I've been talking a lot about AI-JSX as an open source project, of course, I'm standing in front of you as a founder of a startup, so we've got to make money somehow. 00:12:01.560 |
And so we're talking about the fixie platform as a really effective way to take AI-JSX applications and host them and run them and manage them in the cloud. 00:12:13.480 |
So we make it really easy to build and deploy these things. 00:12:16.760 |
The fixie cloud service has a fully managed RAG pipeline that does document ingestion, chunking, embedding, vector database, document storage, and all of the things that you need there. 00:12:29.740 |
It fully manages the conversational state between the end user and the agent that you've built, so that you can have full context as part of that interaction with the user. 00:12:42.060 |
We provide interfaces to all the popular LLMs, and those are really tuned for high performance and low latency, so that we get really good performance out of this. 00:12:50.060 |
You can build your applications either in a no-code way, completely in the web UI here, or you can use AI-JSX to build a completely custom thing. 00:13:00.380 |
And as I showed earlier, embedding it on your website is super easy. 00:13:09.520 |
Right, so with that, you know, I'd encourage you all to try it out. 00:13:20.140 |
You can use that without using fixie if you want. 00:13:24.520 |
I'd really, really love to get your feedback and hear more about what you want to build and what kind of things you want to do. 00:13:39.380 |
Another thing we built with AI-JSX is the ability to support real-time voice interaction. 00:13:47.360 |
You can speak to the agent and it can speak back to you. 00:13:50.380 |
And we've done a ton of work to make the performance as just incredible, just amazing as possible. 00:13:57.060 |
If you've seen the ChatGPT voice demos that they did last week or so, there's something like a four or five second gap after you talk to it and it talks back to you. 00:14:06.900 |
I'm going to show you a demo in a moment that I think will be fairly impressive. 00:14:13.040 |
So we get state-of-the-art performance, real-time, bi-directional conversations and, of course, it's all grounded on your docs and your data. 00:14:21.180 |
So I'm not foolish enough with the Wi-Fi that's here to do a live demo, so fortunately our CTO, Justin, recorded a video of this, but I want to assure you that nothing in this video is staged, nothing has been trimmed out, nothing has been sped up. 00:14:37.320 |
This is real-time, you know, live video recording from yesterday, and you can try it out yourself at voice.fixie.ai if you don't believe me, just go try it on your own machine, not now, not here, please. 00:14:51.400 |
But the idea of this demo is we have a fictional donut restaurant called Dr. Donut, and you're at the drive-thru. 00:14:59.060 |
You drive up in your Tesla or whatever you're driving, roll down the window, and you're talking to the drive-thru window at the Dr. Donut, and the AI is acting to take your order. 00:15:09.960 |
And so with that, I'm going to see if this works. Hopefully we have sound on the video, and let's take it away. 00:15:16.040 |
Welcome to Dr. Donut, home of the best donuts in town. How can I help you? 00:15:21.180 |
Yeah, can I get two of the pumpkin spice iced donuts? 00:15:25.540 |
Sure, I've added two pumpkin spice iced donuts to your order. Can I assist you with anything else? 00:15:35.960 |
Our pumpkin spice coffee is a popular choice this season, and our caramel macchiato is a favorite all year round. 00:15:49.940 |
Great. I've added two caramel macchiatos to your order. Can I get you anything else? 00:15:58.080 |
Yeah, what are your thoughts on large language models? 00:16:10.400 |
Sure, your order is two pumpkin spice iced donuts and two caramel macchiatos. 00:16:23.980 |
And that was all, like, you can go try it yourself. 00:16:27.340 |
We've done a ton of work to make the latency really low, to make the quality really high. 00:16:31.060 |
It's using the full Fixie platform as a back-end. 00:16:33.700 |
And, of course, if you're building with Fixie and AIJSX, you can build the same thing for yourself. 00:16:43.260 |
I'd really love to get you all to check it out. 00:16:45.800 |
We are of course hiring and so there's our careers page and please, you know, don't forget to smash that like button. Thank you very much.