prompt-builder
TypeScript icon, indicating that this package has built-in type declarations

4.0.4 • Public • Published

Prompt Builder is a TypeScript library that allows you to build and validate template prompts. You can create dynamic templates with embedded variables and add type checks on these variables.

This library leverages TypeScript's string literal types to perform compile-time validation. It also integrates with the Zod library, providing runtime validation.

Installation

bun install prompt-builder
pnpm add prompt-builder

Or using yarn:

yarn add prompt-builder

Or using npm:

npm install --save prompt-builder

Usage

Here's a basic usage of the library:

import { PromptBuilder } from 'prompt-builder';

const promptBuilder = new PromptBuilder("Tell me a {{jokeType}} joke");

const prompt = promptBuilder.build({
  jokeType: "funny",
});

console.log(prompt);  // "Tell me a funny joke"

The library is primarily comprised of two main classes, Prompt and PromptBuilder.

https://blamy.gitbook.io/prompt-builder

Running Tests

We have included a suite of tests for validating the functionality of the library. You can run these tests using the following command:

bun test:watch
npm run test

Contributions

We welcome contributions to the library. Please raise an issue or create a pull request on the project's GitHub page.

License

This project is licensed under the MIT License. Please see the LICENSE file for more details.

Dependencies (1)

Dev Dependencies (6)

Package Sidebar

Install

npm i prompt-builder

Weekly Downloads

19

Version

4.0.4

License

ISC

Unpacked Size

53.6 kB

Total Files

19

Last publish

Collaborators

  • bel423