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.
# npm
npm install tolly
# yarn
yarn add tolly
# pnpm
pnpm add tolly
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);
Option | Type | Default | Description |
---|---|---|---|
apiKey |
string | null |
null |
Your Tolly API key |
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: "john.doe@company.com",
},
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"],
},
});
MIT ยฉ Tolly
Made with โค๏ธ for the developer community