Hasty Briefsbeta

Show HN: "Code Mode" for Vercel AI SDK

15 hours ago
  • #Vercel AI SDK
  • #JavaScript
  • #Tool Scripting
  • Introduces a plug-n-play 'code mode' tool call scripting for Vercel AI SDK, inspired by Cloudflare's Code Mode.
  • LLMs are better at writing JavaScript than using synthetic tool calling syntax.
  • Install via npm: `npm install ai tool-scripting`.
  • Includes example usage with `generateText`, `tool`, and `stepCountIs` from 'ai' package.
  • Defines tools like `getUserLocation` and `getWeather` with schemas and execute functions.
  • Wraps `generateText` with `toolScripting` for enhanced functionality.
  • Highlights benefits: better LLM performance, composability, security, and simplicity.
  • Compares traditional tool calls vs. Tool Scripting approach with examples.
  • Requires Node.js 18+ and Vercel AI SDK (`ai` package).
  • Works with both TypeScript and JavaScript, licensed under MIT.