npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

promptcore

v0.1.5

Published

Simple and intuitive engine for prompt templating.

Downloads

22

Readme

PromptCore

Supercharge Your Templating Journey

npm version License: MIT

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