Skip to Content
AI

AI

Structured LLM calls with budget caps, caching, failover, tool loops and grounded answers.

betaOn npm, API may still change

npm i @dapplelight/signet-ai

Quick start

import { z } from "zod"
import { createExtractor, memoryCache, createBudgetLedger } from "@dapplelight/signet-ai"
import { aiSdkProvider } from "@dapplelight/signet-ai/providers/ai-sdk"
import { model } from "./model"

const ai = createExtractor({
  providers: [
    aiSdkProvider({ name: "primary", model, pricing: { inputPerMTokens: 0.15, outputPerMTokens: 0.6 } }),
  ],
  cache: memoryCache(),
  ledger: createBudgetLedger(5, 86_400), // $5 per day, fails closed
})

const { value, meta } = await ai.extract({
  schema: z.object({ category: z.string(), maxPrice: z.number().nullable() }),
  input: "snowboards under 8000",
  instructions: "Pull the category and the price cap from this request.",
})

Output is validated against your schema. That guarantees shape, not truth: check values that could do harm against the input.

Modules