Skip to content

ddaras/tolly-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Tolly Logo

Tolly

The TypeScript-first SDK for structuring unstructured data

npm version TypeScript MIT License

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 tolly

Basic 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 resolve
  • options (object) - Resolution options
    • input (any) - Input data for the function (messy/fuzzy data)
    • description? (string) - Optional function description
    • schema (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"],
  },
});

๐Ÿ“„ License

MIT ยฉ Tolly


Made with โค๏ธ for the developer community

Releases

No releases published

Packages

No packages published