Scripting environment with convenient tooling for file ingestion, prompt development and structured data extraction.
Features
- 💵 Prompt programmatically using stylized JavaScript.
// define the context
def("FILE", env.files, { endsWith: ".pdf" })
// define the data
const schema = defSchema("DATA", { type: "array", items: { type: "string" } })
// define the task
$`Analyze FILE and
extract titles to JSON compliant with ${schema}.`
📁 Scripts are files! They can be versioned, shared, forked, ...
📊 Define, validate, repair data using schemas.
const data = defSchema("MY_DATA",
{ type: "array", items: { ... }, })
$`Extract data from files using ${data} schema.`
const { pages } = await parsers.PDF(env.files[0])
// embedding vector index and search
const files = await retrieval.vectorSearch("cats", env.files)
- 🚀 Automate using the CLI.
npx --yes genaiscript run my-script "*.pdf"
// summarize each files individually
for (const file of env.files) {
const { text } = await runPrompt((_) => {
_.def("FILE", file)
_.$`Summarize the FILE.`
})
// use result in main prompt
_.def("SUMMARY", text)
}
// use summary
$`Summarize all the summaries.`
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
trademarks or logos is subject to and must follow
Microsoft's Trademark & Brand Guidelines.
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
Any use of third-party trademarks or logos are subject to those third-party's policies.