Workshop: Building AI apps with the AI SDK and Next.js December 2024
This is a Next.js project bootstrapped with create-next-app
.
First, to run files in terminal:
pnpm classification
pnpm extraction
Open http://localhost:3000 with your browser to see the result for the following routes:
/summarize
/extraction
/chat
This project uses next/font
to automatically optimize and load Geist, a new font family for Vercel.
- AI SDK
- OpenAi models
- Zod library
- AI/react hooks
Main ways to use ai:
- await generateText({})
- await generateObject({})
- streamText({})
- streamObject({})
Objects need a schema, that's where Zod came into play.
Zod descriptions (.describe()) are super usefull to tell the model how the answer should look like or what is the context that it might need to generate a better more specific answer.
Adding a system prompt allows for customizing the "voice" of the model answer.