Skip to content

About

Code examples implemented with different AI frameworks (Vercel AI SDK, Mastra, Langchain.js, Genkit) to compare them and decide which one to choose for next projects

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

AI SDK Comparison

Typecheck

Code examples implemented with different AI frameworks, such as Vercel AI SDK, Mastra, Langchain.js, and Genkit.

The main aim is to compare the frameworks and decide which one to choose for next projects.

All of the examples use the same model (Anthropic Claude Sonnet 4.6 by default, configurable through the ANTHROPIC_MODEL env var) for cleaner comparison.

Check out @kkomelin's companion post on his blog.

Installation

Clone the repo:

git clone git@github.com:kometolabs/ai-sdk-comparison.git
cd ai-sdk-comparison

Install dependencies:

pnpm i

Configure environment variables:

cp .env.example .env

Then set your ANTHROPIC_API_KEY in .env.

Usage

Simple non-interactive example without tools plugged:

# src/vercel/simple.ts
pnpm vercel:simple
# src/genkit/simple.ts
pnpm genkit:simple
# src/langchain/simple.ts
pnpm langchain:simple
# src/mastra/simple.ts
pnpm mastra:simple

Simple non-interactive example with a Temperature tool plugged:

# src/vercel/tool.ts
pnpm vercel:tool
# src/genkit/tool.ts
pnpm genkit:tool
# src/langchain/tool.ts
pnpm langchain:tool
# src/mastra/tool.ts
pnpm mastra:tool

Interactive Chat example with a Temperature tool plugged:

# src/vercel/chat.ts
pnpm vercel:chat
# src/genkit/chat.ts
pnpm genkit:chat
# src/langchain/chat.ts
pnpm langchain:chat
# src/mastra/chat.ts
pnpm mastra:chat

Ask something like this to run the temperature tool:

What's the temperature in New York?

Contribute

If you see ways to improve the examples, e.g. adapt them to the latest framework updates, shoot a PR.

About

Code examples implemented with different AI frameworks (Vercel AI SDK, Mastra, Langchain.js, Genkit) to compare them and decide which one to choose for next projects

Topics

Resources

Stars

4 stars

Watchers

0 watching

Forks

Contributors

Languages