promptcore
v0.1.5
Published
Simple and intuitive engine for prompt templating.
Downloads
1
Maintainers
Readme
PromptCore
Supercharge Your Templating Journey
Welcome to PromptCore — the evolution of prompt-templating. We've bridged the gap between the classic templating style and the extended features you've been missing. Whether you're deep into prompt engineering or just stepping into dynamic templating, we've got your back.
🌟 Features
Universal Templating: Compatible with both frontend and backend, written in TypeScript.
Community: We've adopted the [] over {}, paying homage to the myriad of prompt templates scattered across blog posts, invaluable Twitter snippets, and treasured shared repositories.
Extended Syntax: While we've ensured we're in tune with established prompt template collections, we've also added hints, default values, select options, and conditionals, all via an intuitive syntax.
Light & Quick: Efficient in performance without any bulk.
Crafted for Interactivity: Built mainly for interactive prompts, yet versatile enough for any templating scenario.
🚀 Let's Get Rolling
npm install promptcore
Basic Crafting
const { PromptCore } = require('promptcore');
let template = new PromptCore('Write an article about [topic]');
let prompt = template.render({ topic: 'prospects of AI' });
console.log(prompt); // Write an article about prospects of AI
import { PromptCore } from 'promptcore';
let template = new PromptCore('Write an article about [topic]');
let prompt = template.render({ topic: 'prospects of AI' });
console.log(prompt); // Write an article about prospects of AI
📖 Syntax & Craftsmanship
Simple prompt template:
Write an article about [topic]
Add non-rendered hints:
Write an article about [topic # e.g. prospects of AI]
Set defaults:
Write an article about [topic = LLMs in day-to-day life]
Lay out choices:
Explain meaning of [color = red, blue, green]
Yes, default value is just first option.
Double quote strings with special characters
Write an article about an influence of music by [band = "Guns N' Roses", "The Beatles", "AC/DC"].
🔗 Todo
We are working on adding more features to make PromptCore even more powerful. Here's what we have in mind:
Conditionals
Choose what shows up:
Write an article about an influence of music by [band = "Guns N' Roses", The Beatles, "AC/DC", "Panic! At The Disco"]
[[if name == The Beatles]] and their song "[song = "Lucy in the Sky, with Diamonds", "She Said, She Said", "Yes, It Is"]"
[[else if name]] and their most popular songs
[[else]][[/if]].
We are thinking on more intuitive syntax for conditionals, so stay tuned!
Pipes
Add pipes to variables:
Write an article about [topic | trim | capitalize first]
Custom functions
Add pipes to variables:
Write an article about [topic | your function: argument, another argument]
Feel free to suggest your ideas!
🔗 Used By
We built PromptCore to help us craft PromptReaper - a tool for batch processing and automating prompt templates, with community-driven collections of prompts.
Want to see your project here? Just shoot us a message!
- PromptReaper:
🤝 Join the Craft
Got ideas? Enhancements? Or just found something quirky? We're all ears and code. Dive into our contributing guidelines and be part of the magic.
📜 License
MIT