Support triage
Summaries, tags, and priority suggestions arrive back as validated JSON. No parsing branches or prompt gymnastics.
Turn LLM prompts into typed functions, and call it like any other application code. Nuabase enforces the schema, retries failures, caches rows granularly, and tracks your per-customer token cost. It beams structured JSON results directly to your front-end using Server Sent Events, and delivers them to your back-end through webhooks.
import { z } from "zod";
import { Nuabase } from "@nuabase/sdk";
const nua = new Nuabase({ apiKey: process.env.NUABASE_API_KEY });
const summarizeThread = nua.fn({
name: "summarizeSupportThread",
output: z.object({
summary: z.string(),
nextAction: z.string(),
priority: z.enum(["low", "normal", "urgent"]),
}),
prompt: "Summarize the conversation and suggest the next action. Thread: ",
});
const result = await summarizeThread({ body: ticket.comments });
// result: { summary: string; nextAction: string; priority: "low" | "normal" | "urgent" }
Drop it into any service, stream progress to the UI, and rely on the contract every call.
Summaries, tags, and priority suggestions arrive back as validated JSON. No parsing branches or prompt gymnastics.
Convert free-form notes into firmographics and recommended follow-ups that drop straight into your CRM.
Flag edge cases with consistent verdicts and reasoning fields that your automation can consume immediately.
Pipe outlines, highlights, and extracted fields straight to your UI with progress streaming along the way.
Create a typed function once, call it from anywhere. Nuabase SDKs expose a regular async function whose return value already matches your schema. No parsing, no JSON juggling, just domain objects.
Decide the rows, tickets, or documents you want enriched and pass them in as plain data.
const leads = [
{ id: "lead-101", notes: "Growth-stage SaaS, ~80 employees, wants a demo." },
];
Define the fields and enums you expect so every run returns the same structure.
const LeadInsights = z.object({
industry: z.string(),
company_size: z.enum(["SMB", "Mid-market", "Enterprise"]),
});
Write the instructions as an LLM prompt — Nuabase turns it into a callable function that lives alongside your code.
const classifyLeads = new Nua().map({
name: "insights",
output: LeadInsights,
prompt: "Classify each lead with industry and company_size bucket.",
});
Call it like any async function, watch streaming progress, and ship the feature without custom orchestration.
const result = await classifyLeads.now(leads, "id");
if (result.isError) throw new Error(result.error);
console.log(result.data[0].insights);
// -> { industry: "Software", company_size: "Mid-market" }
Each response is validated before you see it—failed rows are retried automatically.
Long tasks move to managed queues with webhooks, backoff, and replay support.
Server-sent events keep the UI updated while the model runs.
Cache hits, cost per customer, and usage metrics ship with every response.
We currently have a TypeScript SDK that provides well-typed outputs using Zod, as well as an HTTP API that you can invoke with JSON Schema. If you need support for other languages, please let us know.