# @isdk/ai-tool-prompt

> * Management of various prompts * Collection The LLM System template prompts With Enhancement (guessing corresponding system templates based on the model file name) * Multiple versions support under the same system prompt template file * Recommendation of

Latest version **0.4.2** (published 2025-09-26) · 0 weekly downloads

## Install

```sh
npm install @isdk/ai-tool-prompt
pnpm add @isdk/ai-tool-prompt
yarn add @isdk/ai-tool-prompt
bun add @isdk/ai-tool-prompt
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads; pre 1.0.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2025-09-26 |
| First published | 2024-06-08 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.11.1 |
| Dependencies | 7 |
| Unpacked size | 259.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Riceball LEE |
| Maintainers | isdk |
| Keywords | ai, ai-tool, tool, llm, prompt |

## Links

- npm: https://www.npmjs.com/package/@isdk/ai-tool-prompt
- Repository: https://github.com/isdk/ai-tool-prompt.js
- Issues: https://github.com/isdk/ai-tool-prompt.js/issues
- npm.io page: https://npm.io/package/@isdk/ai-tool-prompt

## Dependencies (7)

- [yaml](https://npm.io/package/yaml.md) ^2.7.0
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.21
- [yaml-types](https://npm.io/package/yaml-types.md) ^0.4.0
- [@isdk/ai-tool](https://npm.io/package/@isdk/ai-tool.md) ^0.8.1
- [load-config-file](https://npm.io/package/load-config-file.md) 2.0.0
- [property-manager](https://npm.io/package/property-manager.md) 2.0.0
- [@isdk/ai-tool-sqlite](https://npm.io/package/@isdk/ai-tool-sqlite.md) ^0.1.15

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.4.2 (latest) — 2025-09-26
- 0.4.1 — 2025-09-21
- 0.4.0 — 2025-09-21
- 0.3.7 — 2025-04-04
- 0.3.6 — 2025-03-22
- 0.3.5 — 2025-03-17
- 0.3.4 — 2025-03-17
- 0.3.3 — 2025-03-16
- 0.3.2 — 2025-03-16
- 0.3.1 — 2025-03-16
- 0.3.0 — 2025-03-16
- 0.2.7 — 2024-12-18
- 0.2.6 — 2024-12-17
- 0.2.5 — 2024-12-15
- 0.2.4 — 2024-10-04
- … 26 more at https://npm.io/package/@isdk/ai-tool-prompt/versions

## README

# ai-tool-prompt

* Management of various prompts
* Collection The LLM System template prompts With Enhancement (guessing corresponding system templates based on the model file name)
* Multiple versions support under the same system prompt template file
* Recommendation of parameters for LLM models
* Extensible multiple template formats to write system prompt template: jinjia2 (hf), golang (ollama), python fstring (langchain). Here jinjia2 is used as the default template format.
* Extensible file format: `yaml`, `json`. Here yaml format is used as the default file format.

## Installation

```bash
npm install @isdk/ai-tool @isdk/ai-tool-prompt
```

## Prompt Structure

* _id: `string` (unique) - id of the prompt
* templateFormat: `'hf'|'ollama'|'langchain'` - template format of the prompt, defaults to 'hf'
* template: `string` - template of the prompt, eg, '{{messages[0].content}}'
* type: `'system'|'tool'|'char'` - type of the prompt
* prompt: `object` - default prompt template data
* modelPattern: `string|RegExpr|(string|RegExpr)[]|{[version:string]: string|RegExpr}` - pattern(s) to match the LLM model file name
* parameters: `{[ruleMatched: string]: object]}` - the default parameters of LLM models
  * the key is the matched rule named group: `id` or `group[1]`, it is lowercase always.
  * the value is parameters of the LLM model
* extends: `string` - the id of the parent prompt to inherit
* version: `{[name: string]: object}` - the version/feature info of the prompt
  * the key is the name of the version/feature
  * the value is the prompt to overwrite.

The Current Default System Prompt Templates: [here](./prompts/)

The `YAML`(`.yaml`|`.yml`) and `JSON`(`.json`) file format are supported.

## Usage

The following code snippet shows how to use the prompts by `AIPromptsFunc` sqilteDB.

```js
import { AIPromptsFunc } from '@isdk/ai-tool-prompt';

const promptsDB = new AIPromptsFunc(AIPromptsName, {dbPath: ':memory:'})
// load default system template prompts automatically into sqliteDB
await promptsDB.initData()

const promptInfo = await promptsDB.$getPrompt({ model: 'qwen2.5-7b-it.gguf', type: 'system' })
console.log(promptInfo)
// {prompt: ..., version: 'qwen'}
```

The following code snippet shows how to use the prompts by `findPrompt` function.

```js
import { parse as parseIni } from 'ini'
import { ConfigFile, getConfigs } from '@isdk/ai-tool';
import { findPrompt } from '@isdk/ai-tool-prompt';

// add your prompt file format parser
ConfigFile.register(['.ini'], parseIni)

// load all prompts from your prompts directory, searh all .ini|json|yaml|yml files
const prompts = getConfigs('dir/your-prompts-dir')
const promptInfo = await findPrompt(prompts, 'qwen2.5-7b-it.gguf', { type: 'system' })
```

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