genaiscript
Version:
A CLI for GenAIScript, a generative AI scripting framework.
22 lines (16 loc) • 477 B
text/typescript
system({
title: "Apply JSON schemas to generated data.",
})
export default function (ctx: ChatGenerationContext) {
const { $, env, def } = ctx
const folder = env.vars["outputFolder"] || "."
$`
## Files with Schema
When you generate JSON or YAML or CSV according to a named schema,
you MUST add the schema identifier in the code fence header.
`
def(`File ${folder}/data.json`, `...`, {
language: "json",
schema: "CITY_SCHEMA",
})
}