tolly
v0.1.5
Published
A TypeScript package with the main Tolly class
Readme
The TypeScript-first SDK for structuring unstructured data
Tolly is a simple AI tool that lets you resolve smart values from messy data using an API — no prompts, no logic trees, just structured answers.
🚀 Quick Start
Installation
# npm
npm install tolly
# yarn
yarn add tolly
# pnpm
pnpm add tollyBasic Usage
import Tolly from "tolly";
// Initialize with your API key
const tolly = new Tolly({
apiKey: "your-api-key-here",
});
// Resolve a function
const result = await tolly.execute("myFunction", {
input: { message: "Hello, world!" },
description: "Process greeting message",
schema: { type: "object" },
});
console.log(result);📚 API Reference
Constructor Options
| Option | Type | Default | Description |
| -------- | ---------------- | ------- | ------------------ |
| apiKey | string \| null | null | Your Tolly API key |
Methods
execute(funcName, options)
Resolves a function through the Tolly API.
Parameters:
funcName(string) - Function identifier to resolveoptions(object) - Resolution optionsinput(any) - Input data for the function (messy/fuzzy data)description?(string) - Optional function descriptionschema(any) - Output JSON schema definition
Returns: Promise<any> - Resolved structured data based on the schema you provided.
Example:
const { category, priority, sentiment } = await tolly.execute("labelTicket", {
input: {
ticket: {
title: "Can't login to my account",
description:
"I've been trying to log in for the past hour but keep getting an error message. This is urgent as I need to access my project files for a client meeting tomorrow.",
userEmail: "[email protected]",
},
availableCategories: [
"authentication",
"billing",
"technical-support",
"feature-request",
],
},
schema: {
type: "object",
properties: {
category: { type: "string" },
priority: { type: "string", enum: ["low", "medium", "high", "urgent"] },
sentiment: { type: "string", enum: ["positive", "neutral", "negative"] },
},
required: ["category", "priority", "sentiment"],
},
});📄 License
MIT © Tolly
