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

thnk

v1.1.0

Published

Makefiles for AI text generation

Downloads

11

Readme

Thnk

Thnk is a command-line tool that automates the process of generating files based on AI models, similar to how Make automates the building of software. It uses a configuration file, akin to a Makefile, to manage dependencies and determine the operations required to generate target files from source files.

Creating AI generation pipelines

Thnk allows you to create pipelines from subsequent prompts and generations, ensuring that only the necessary files are regenerated. This means that if a dependency changes, Thnk will determine which target files need to be updated, saving time and costs.

(Automatically thnking the entire pipeline is not yet implemented.)

Version controlling prompts and outputs

Thnk also helps in version controlling of AI prompts with git, allowing you to track changes in your prompt files over time. By committing your prompts and the generated outputs, you can see how modifications to the prompts influence the generated text, aid collaboration and improve reproducibility.

Installation

To install Thnk, you need Node.js. Once Node.js is installed, you can install Thnk using npm:

npm install -g thnk

Ensure that you have set the OPENAI_API_KEY environment variable to use the OpenAI models:

export OPENAI_API_KEY='your_openai_api_key_here'

Optionally, you can set the OPENAI_MODEL environment variable to specify the model to use. The default is gpt-4o-mini.

export OPENAI_MODEL='gpt-4o'

Usage

To use Thnk, you need to create a Thnkfile in your project directory. This file defines the targets, dependencies, and the AI model configurations needed to generate your files.

Run Thnk in your terminal:

thnk

Thnk will read the Thnkfile, check for changes in dependencies, and regenerate the target files if necessary.

Thnkfile Syntax

A Thnkfile consists of targets, dependencies, and recipes. Here’s a brief overview of its syntax:

  • Targets and Dependencies: Each entry in the Thnkfile specifies a target file and its dependencies.

    target: dependency1 dependency2
  • Recipes: The recipe is an indented block of text that's used as a prompt to generate the target file from the dependencies. Instead of providing the recipe in the Thnkfile, you include a *.prompt.md or prompt.md file among the dependencies.

    target: dependency1 dependency2
        Recipe to generate target from dependencies
    target: dependency1 dependency2 my.prompt.md
  • Schema files: For .json targets, you can specify a *.schema.json or schema.json file containing a JSON schema, this will be used as a schema for the output JSON file.

    target.json: dependency1 dependency2 my.schema.json
      Generate a JSON file so that...

See the examples folder for sample Thnkfile configurations.