eleventy-plugin-local-ai
v0.0.6
Published
An eleventy plugin for generating static assets from text prompts
Downloads
5
Maintainers
Readme
eleventy-plugin-local-ai
An experimental eleventy plugin for generating static websites using generative ai. Uses LocalAI to generate static assets from prompts stored as .md
files.
Prerequisites
Make sure to install LocalAI before use.
Installation
npm i -D @11ty/eleventy eleventy-plugin-local-ai
Usage
Register the plugin in your .eleventy.js
file.
const localAIPlugin = require('eleventy-plugin-local-ai');
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(localAIPlugin);
};
Then create a .md
file for each page that you want on your website that contains a description that is 1600 tokens or fewer (the plugin reserves 448 tokens for prompt engineering).
The index.md
file is registered as the homepage.
See the example repository here for an example of how to use the plugin.
Options
modelName
Choose which LocalAI-supported model to use to generate your static website. Defaults to thebloke__codellama-7b-gguf__codellama-7b.q5_k_m.gguf
.
eleventyConfig.addPlugin(localAIPlugin, {
modelName: 'thebloke__codellama-7b-gguf__codellama-7b.q5_k_m.gguf'
});
verbose
Enables verbose logging. Good for debugging.
eleventyConfig.addPlugin(localAIPlugin, {
verbose: true
});
baseUrl
The url that your LocalAI instance is listening on. Defaults to 8080, the port LocalAI listens on by default.
eleventyConfig.addPlugin(localAIPlugin, {
baseUrl: 'http://localhost:3002'
});
timeout
The number of milliseconds to wait before timing out the request. Defaults to 3600 seconds (1 hour)
eleventyConfig.addPlugin(localAIPlugin, {
timeout: 3600e3
});
prompts
Used to customize prompts. Provide an object with one or both methods that generate prompts from the context.
initialCode
Provide the prompt for the initial code generation.
eleventyConfig.addPlugin(gpt4AllPlugin, {
prompts: {
initialCode: (prompt, lang) => `Please generate code matching the prompt ${prompt} in the language ${lang}`
}
});
codeReview
Provide the prompt for the code review.
eleventyConfig.addPlugin(gpt4AllPlugin, {
prompts: {
codeReview: (lang, code) => `Please perform a code review of the code ${code} in the language ${lang}`
}
});
Disclaimer
Please review the code generated by LocalAI before deploying to production.