Vercel AI SDK Masterclass: From Fundamentals to Deep Research
AI Engineer
Channel
Interviewed Person
Nico Albanese
Description
Full workshop presented by Nico Albanese from Vercel, at the 2025 AI Engineer Summit in New York, Feb 2025: https://x.com/nicoalbanese10 and https://github.com/nicoalbanese workshop content/guidebook: https://aie-feb-25.vercel.app/docs Organizers note: We somehow screwed up and experienced a total loss of the original workshop video. Nico was incredibly gracious about it and rerecorded the whole thing for you! thank you Nico! Please give him a shoutout: https://x.com/nicoalbanese10
Transcript
hey folks my name is Nico i work on the AI SDK at Verscell and in this session today we're going to be looking at building agents with the AI SDK now this session is roughly divided into two sections we're going to start with a fundamental section this is going to introduce you to the building blocks that you need to understand about using the AI SDK before we jump into building agents and then we're going to be building a deep research clone uh in Node.js js so without further ado let's get right into it to follow along the
first thing that you're going to have to do is clone the repository here install the dependencies copy over uh any environment variables um and then you'll be ready to go in this project we have just one file index.ts and you can run this file by just running pmpp rundev i have this alias to just pd so if you see me typing that that's just running the script great so let's start with the first primitive that we're
going to be looking at the generate text function now this is as it sounds a way for you to call a larger language model and generate some text so let's take a look in this session rather than typing everything out line by line I'm going to be copying over snippets so we can get through things a little bit faster and focus on the core concepts rather than necessarily remembering to type everything out properly so let's start with the first snippet what we've got here is a single
function called main it's asynchronous and inside this function we call generate text which we import from the AI SDK we specify the model we want to use in this case OpenAI's GPT40 mini um and then we pass in a prompt hello world finally we log out the resulting text that is generated and call the function so we can head into the terminal run
pmppm rundev and we should see a message back from GPT4 mini hello how can I assist you today now each of these generate text functions and uh stream text and generate object and stream object as we'll see later uh can take in either a prompt as input or messages and in this case messages is just an array of messages where a message has a role and then some content so this would be the same as we had before if we change this
to user for the rest of this session we'll be using mostly the prompt key so one of the core features of the AI SDK is its unified interface and what that means is that we're able to switch between language models by just changing one single line of code now there are many reasons why you might want to do this it might be because a model is cheaper faster um better at your specific use case um and speaking of better one thing that we can try asking this model in
particular is uh something that we know it might struggle with like when was the AI engineer summit in 2025 now I know for a fact that GPT40 Mini is not going to be able to do this because it doesn't have access to the web and its training data cutoff is somewhere in 2024 so we can see I'm sorry but I don't have information about
events scheduled for 2025 including the AI engineer summit so how could we solve this well we could and we'll look into later add a tool and that tool could call the web and return those results and pipe those into the context of the conversation and then the language model can deduce from there but we could also just pick a model that has web search built in something like perplexity so how do we change to a different model
Video Details
- Duration
- 59:52
- Published
- April 20, 2025
- Channel
- AI Engineer
- Language
- ENGLISH
- Views
- 23,759
- Likes
- 844