# 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.

Latest version **4.0.4** (published 2023-09-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install prompt-builder
pnpm add prompt-builder
yarn add prompt-builder
bun add prompt-builder
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.4 |
| Published | 2023-09-24 |
| First published | 2023-05-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 52.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bel423 |

## Links

- npm: https://www.npmjs.com/package/prompt-builder
- npm.io page: https://npm.io/package/prompt-builder

## Dependencies (1)

- [zod](https://npm.io/package/zod.md) ^3.22.2

## Recent versions

- 4.0.4 (latest) — 2023-09-24
- 4.0.3 — 2023-09-24
- 4.0.2 — 2023-09-23
- 4.0.1 — 2023-09-23
- 4.0.0 — 2023-09-23
- 3.3.0 — 2023-06-15
- 3.2.0 — 2023-05-30
- 3.1.0 — 2023-05-30
- 3.0.4 — 2023-05-28
- 3.0.3 — 2023-05-28
- 3.0.2 — 2023-05-28
- 3.0.1 — 2023-05-28
- 3.0.0 — 2023-05-28
- 2.2.0 — 2023-05-27
- 2.1.0 — 2023-05-27
- … 4 more at https://npm.io/package/prompt-builder/versions

## README

# [Prompt Builder](https://blamy.gitbook.io/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


```bash
bun install prompt-builder
```

```bash
pnpm add prompt-builder
```

Or using yarn:

```bash
yarn add prompt-builder
```

Or using npm:

```bash
npm install --save prompt-builder
```

## Usage

Here's a basic usage of the library:

```ts
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](https://blamy.gitbook.io/prompt-builder)

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:

```bash
bun test:watch
```

```bash
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.

---
_Source: https://npm.io/package/prompt-builder · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
