https://github.com/ryanfarber/prompty
llm prompt helper
https://github.com/ryanfarber/prompty
Last synced: about 1 year ago
JSON representation
llm prompt helper
- Host: GitHub
- URL: https://github.com/ryanfarber/prompty
- Owner: ryanfarber
- Created: 2025-06-27T03:33:49.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-27T03:39:11.000Z (about 1 year ago)
- Last Synced: 2025-06-27T04:53:09.681Z (about 1 year ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prompter
a simple tool to help format LLM prompts dynamically
## usage
```javascript
const Prompter = require("@ryanforever/prompter")
const prompter = new Prompter({
fromFiles: {
systemPrompt: "./prompts/system-prompt-v1.js"
},
fromText: {
prompt2: "you are a helpful assistant named {{assitantName}}. the current date is {{currentDate}}" // format variables in {{}}
},
strict: false // throw error if input variables do not match prompt variables, or variables are missing
})
// assign variables at run time
let prompt = prompter.get("prompt2", {
assitantName: "botlab",
currentDate: new Date(Date.now())
})
// upsert prompt variables. this will only change the {{currentDate}} variable, leaving all other variables the same
prompt = prompter.update("prompt2", {
currentDate: new Date(Date.now())
})
```
## tools
```javascript
const prompter = require("@ryanforever/prompter")
// in line text prompt
let prompt1 = prompter.fromText("hello {{username}}", {
username: "ryan forever"
})
// read prompt text from a file instead
let prompt2 = prompter.fromFile("./my-prompt.txt", {
currentDate: new Date(Date.now())
})
```