Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>GenAIScriptNew to Visual Studio Code? Get it now.
GenAIScript

GenAIScript

Microsoft

microsoft.com
|
9,457 installs
| (1) | Free
Generative AI Scripting.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Scripting environment with convenient tooling for file ingestion, prompt development and structured data extraction.

A screenshot of a code editor with multiple tabs open, showing TypeScript code for a "Code Optimizer" script. The editor displays a script with a class named "Greeter" and a description of optimizing code performance. The right pane previews the script's output and optimization suggestions. The left sidebar contains file navigation and icons for various functions.

  • 👀 Read the documentation at https://microsoft.github.io/genaiscript/
  • 💬 Join the Discord serverJoin the Discord server

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}.`
  • ⚡️ Edit, debug, run your scripts

A screenshot of a Visual Studio Code interface in debug mode, showing a paused breakpoint in a JavaScript file. The left side displays the "WATCH" and "CALL STACK" panels, while the right side shows code involving a filter function and a Python file label.

  • 📁 Scripts are files! They can be versioned, shared, forked, ...

  • 📊 Define, validate, repair data using schemas. Zod support builtin.

const data = defSchema("MY_DATA",
    { type: "array", items: { ... }, })
$`Extract data from files using ${data} schema.`
  • 📄 Ingest PDFs, DOCX, CSV, ... PDFs, DOCX, CSV, ...
const { pages } = await parsers.PDF(env.files[0])
  • 🔍 Vector search
// embedding vector index and search
const files = await retrieval.vectorSearch("cats", env.files)
  • 🚀 Automate using the CLI.
npx --yes genaiscript run my-script "*.pdf"
  • 👯 compose prompts within prompts
// 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.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft