Introduction to tutorial
Most courses about Vercel AI SDK are quite dry and simply rephrase the official documentation. I decided to take different approach - during the course, you will build a chatbot in command line interface (CLI).
You will also learn about Bun and pnpm. Note: You can use NodeJS and npm if you prefer, but learning something new
is fun!
Why command line interface?
I decided to stay away from implementing the chatbot in web as there are many frameworks and implementation details how to connect backend and frontend vary per framework. For NextJS, Svelte, VueJS and Expo - you will find this in the official documentation.
Building a chatbot for CLI will allow you to focus on the core concepts of the Vercel AI SDK, while building a usable interface to interact with the chatbot.
Why Bun?
Bun.sh is a fast all-in-one JavaScript runtime and it can run Typescript directly without compiling.
You don't even need to create tsconfig.json file. Everything just works!
What will you learn during the course
While you will learn basics and some advanced functionalities of the Vercel AI SDK, the important point is that every function will be presented within concrete, real-world context. That means that you will learn how individual parts fit together in more complex scenarios of a chatbot.
Vercel AI SDK
- Generating text responses
- Adding system prompt
- Using different LLM models
- Sending message history to the model
- Generating structured output (JSON)
- Generating enums as structured output
- Generating mock data as structured output
- How to guardrail the topics of the conversation
Command line interface
- Implementing simple command line interface (CLI) with
Commander.js - Implementing a fully functional chat in CLI
Guardrails
- Guardrails with system prompt
- Guardrails with manual topic detection
- Advanced guardrails
Is chatbot in CLI worth building?
Absolutely! The chatbot and the code you write during this course can be reused - for example for creating a clone of yourself on your own website, or reusing the knowledge in a client project.