Skip to content

romannurik/nunjucks-llm

 
 

Repository files navigation

nunjucks-llm is a fork of Nunjucks that makes it easier to use for LLM prompt hydration and interleaving

Currently forked from Nunjucks version: 3.2.4

Changes:

  • A bunch of async/await is now built into the compiler, so expressions that return promises are handled natively.
  • Functions passed as template params can call this.getBuffer() to get the current buffer, which is useful for passing as the prefix to LLMs for completion. For example:
    let template = `
    Color: Blue
    Bird: {{ llm() }}
    `;
    
    async function llm() {
      let prefix = this.getBuffer();
      return await actuallyCallAnLLM(prefix);
    }

Original README below.


Nunjucks

NPM Version NPM Downloads Linux Build Windows Build Test Codecov

Nunjucks is a full featured templating engine for javascript. It is heavily inspired by jinja2. View the docs here.

Installation

npm install nunjucks

To use the file watcher built-in to Nunjucks, Chokidar must be installed separately.

npm install nunjucks chokidar

(View the CHANGELOG)

Documentation

See here.

Browser Support

Supported in all modern browsers. For IE8 support, use es5-shim.

Tests

Run the tests with npm test.

Watch master branch's tests running in the browser.

Mailing List

Join our mailing list and get help with and issues you have: https://groups.google.com/forum/?fromgroups#!forum/nunjucks

Want to help?

Contributions are always welcome! Before you submit an issue or pull request, please read our contribution guidelines.

Contributors

About

A fork of Nunjucks that makes it easier to use for LLM prompt hydration and interleaving

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.6%
  • HTML 4.9%
  • Nunjucks 1.3%
  • Other 0.2%