ai-sdk-tool-as-package-template
v1.0.0
Published
AI SDK tool package template
Readme
AI SDK Tool Package Template
A TypeScript package template for building and publishing AI SDK tools.
Installation
npm install ai-sdk-tool-package-templateUsage
import { weatherTool } from "ai-sdk-tool-package-template";
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
const result = await generateText({
model: openai("gpt-4o-mini"),
prompt: "What's the weather like?",
tools: {
weatherTool,
},
});Development
Setup
- Clone the repository
- Install dependencies:
pnpm install- Create a
.envfile:
cp .env.example .env- Add your OpenAI API key to
.env
Testing
Test your tool locally:
pnpm testBuilding
Build the package:
pnpm buildPublishing
The package automatically builds before publishing:
pnpm publishProject structure
.
├── src/
│ ├── index.ts # Your tool exports
│ └── test.ts # Test script
├── dist/ # Build output (generated)
├── package.json
├── tsconfig.json
└── README.mdLicense
ISC
