# Great Work Labs recipes

## Triage a support inbox

Every incoming ticket gets a language, a queue, a mood and a PII-free copy you can send to your LLM.

Cost: $0.0001 per ticket.

1. `lingo-1`: detect the language to pick the right team
1. `veil-1`: redact emails, phones and card numbers before anything else sees the text
1. `sort-1`: route to billing, bug report, feature request or account access
1. `tone-1`: flag angry customers for a faster reply

```js
const run = (model, body) => labs("/v1/run", { model, ...body });
const lang  = await run("lingo-1", { input: ticket.body });
const clean = await run("veil-1",  { input: ticket.body, redact: "numbered" });
const queue = await run("sort-1",  { input: clean.output.redacted, labels: ["billing", "bug report", "feature request", "account access"] });
const tone  = await run("tone-1",  { input: ticket.body });
// send clean.output.redacted (not ticket.body) to your LLM
```

## Answer from your docs without making things up

Screen retrieved chunks for injected instructions, rerank them, and check the final answer against its sources.

Cost: $0.000425 per question (20 candidates, 3-sentence answer).

1. `atlas-1`: embed your documents once and the question each time
1. `ladder-1`: rerank the top 20 candidates
1. `moat-1`: drop chunks that contain instructions aimed at your model
1. `ground-1`: flag sentences in the answer the sources don't support

```js
const q = await run("atlas-1", { input: question, kind: "query" });
const top = vectorSearch(q.output.embedding, 20);               // your index
const ranked = await run("ladder-1", { input: question, documents: top.map(d => d.text), top_n: 5 });
const chunks = ranked.output.results.map(r => top[r.index].text);
const safe = (await run("moat-1", { input: chunks, threshold: 0.9 })).output;
const context = chunks.filter((_, i) => !safe[i].injection).join("\n\n");
const answer = await yourLLM(question, context);
const check = await run("ground-1", { input: answer, context });   // check.output.sentences[i].supported
```

## Meeting notes with who said what

A recording becomes a speaker-labeled transcript, a summary and a title.

Cost: $0.032 per 30-minute meeting (in 5-minute parts).

1. `scribe-1`: transcribe with `speakers: true`
1. `brief-1`: summarize the transcript
1. `headline-1`: title it for your notes app

```js
const t = await run("scribe-1", { input: audioUrl, speakers: true });
const lines = t.output.segments.map(s => `${s.speaker}: ${s.text}`).join("\n");
const summary = await run("brief-1", { input: lines, length: "long" });
const title = await run("headline-1", { input: summary.output.summary });
```

## Moderate a community

Comments, DMs and uploads each get the check that fits them, so a person only reviews what's flagged.

Cost: $0.00015 per post (comment + one image).

1. `sieve-1`: insults, threats and slurs in comments
1. `warden-1`: self-harm, weapons, drugs and other policy categories
1. `bait-1`: scam and spam DMs
1. `curtain-1`: nudity in uploaded images

```js
const [tox, policy] = await Promise.all([
  run("sieve-1",  { input: post.text }),
  run("warden-1", { input: post.text }),
]);
const img = post.imageUrl ? await run("curtain-1", { input: post.imageUrl }) : null;
const hold = tox.output.flagged || policy.output.flagged || img?.output.nsfw;
```

## Turn receipt photos into expenses

Read the text, then fill your expense schema. Ask Glance when you only need one number.

Cost: $0.0009 per receipt.

1. `ink-1`: read every line of the receipt
1. `mold-1`: fill merchant, date, total, tax and currency
1. `glance-1`: or ask a single question about the image

```js
const text = await run("ink-1", { input: photoUrl });
const expense = await run("mold-1", { input: text.output.text, schema: {
  type: "object", properties: {
    merchant: { type: "string" }, date: { type: "string", description: "YYYY-MM-DD" },
    total: { type: "number" }, tax: { type: "number" }, currency: { type: "string" } } } });
```

## Voice commands for your app

Speech becomes a function call your app can run, with arguments that match your schema.

Cost: $0.00047 per 10-second command.

1. `scribe-1`: transcribe the voice note
1. `cue-1`: pick the function and fill its arguments

```js
const said = await run("scribe-1", { input: audioDataUrl, timestamps: "none" });
const call = await run("cue-1", { input: said.output.text, tools: myTools });
if (call.output.tool) await handlers[call.output.tool](call.output.arguments);
```

## Send each prompt to the cheapest model that can do it

Check the prompt is safe, then pick a small or large LLM by task and complexity.

Cost: $0.00005 per prompt.

1. `warden-1`: refuse unsafe prompts before they cost anything
1. `route-1`: task type and complexity score

```js
const [safety, route] = await Promise.all([run("warden-1", { input: prompt }), run("route-1", { input: prompt })]);
if (safety.output.flagged) return refuse();
const model = route.output.task === "code_generation" || route.output.complexity > 0.35 ? BIG_MODEL : SMALL_MODEL;
```

## Enrich a product catalog

Every product photo gets a clean cutout, alt text, tags and search keywords.

Cost: $0.00363 per product.

1. `cutout-1`: transparent PNG of the product
1. `glance-1`: alt text
1. `prism-1`: your own style tags
1. `pluck-1`: keywords from the description

```js
const [cut, alt, tags, kw] = await Promise.all([
  run("cutout-1", { input: photoUrl }),
  run("glance-1", { input: photoUrl }),
  run("prism-1",  { input: photoUrl, labels: ["minimal", "rustic", "sporty", "luxury", "something else"] }),
  run("pluck-1",  { input: product.description, top_k: 6 }),
]);
```

## Route voicemails

Know the language and the reason for every voicemail before anyone listens to it.

Cost: $0.00116 per 1-minute voicemail.

1. `ear-1`: spoken language from the first 30 seconds
1. `scribe-1`: transcript in that language
1. `sort-1`: reason for the call

```js
const lang = await run("ear-1", { input: voicemailUrl });
const text = await run("scribe-1", { input: voicemailUrl, language: lang.output.language, timestamps: "none" });
const why = await run("sort-1", { input: text.output.text, labels: ["new order", "complaint", "billing question", "appointment"] });
```
