4.0.4 • Published 8 months ago

prompt-builder v4.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
8 months ago

Prompt Builder

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"

Documentation

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.

4.0.4

8 months ago

4.0.1

8 months ago

4.0.0

8 months ago

4.0.3

8 months ago

4.0.2

8 months ago

3.3.0

11 months ago

3.2.0

12 months ago

3.1.0

12 months ago

3.0.4

12 months ago

3.0.3

12 months ago

3.0.2

12 months ago

3.0.1

12 months ago

3.0.0

12 months ago

2.2.0

12 months ago

2.1.0

12 months ago

2.0.0

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago