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

openai-file

v1.12.0

Published

Use this tool to read content from text files, provide a prompt and get the output written to disk.

Downloads

26

Readme

openai-file

Table of Contents generated with DocToc

What is this thing?

A tool that reads a txt file and asks for an openai prompt, model to use and api key.

The tool then passes this data to the openai API.

The output is written to the same location as the input file with "gptoutput.txt" appended.

Screenshot and some words to explain

What happened below on the 1st run:

  1. Created a folder to put my txt files in.
  2. Copy and pasted a load of amazon reviews from a product into a .txt file called "product-reviews.txt"
  3. I then opened a terminal and navigated to the folder mentioned in step 1 and ran this program by typing "openai-file"
  4. I followed each prompt pressing enter after each
  5. This program then wrote the reponse from openai to disk to a file called "product-reviews.txt.gptoutput.txt" Screenshot1

Try run it again with another prompt:

  1. With the terminal still open in the folder run the openai-file program again
  2. This time add a new prompt but for the same file "Write a new 5 star review"
  3. The output will be written to disk again as "product-reviews.txt.gptoutput(1)txt"

You can continue like this forever, but don't forget the input is capped depending on which API you use. GPT4 can accept approx. 25k words.

You might need to request access to GPT4.

How to install (simple for anyone)

  1. Install Nodejs: https://nodejs.org/en
  2. Install this package globally
    1. Open a terminal
    2. Add this command and press enter: sudo npm i -g openai-file
    3. It will ask for your password and then install this openai-file program for you to use

How to use

  1. Create a folder somewhere on your computer to contain some txt files that you want to pass to GPT
  2. Create a txt file eg "myfirst.txt" file
  3. Add some content to the txt file eg, copy and paste this readme file into it.
  4. Open a terminal and make sure it is at the location of your folder.
  5. Run the tool, openai-file
  6. Answer the questions provided:
    1. What is your openai key?
      • See here to get your own API key: https://platform.openai.com/account/api-keys
    2. openAiModel, '4' or '3.5'
      • Select 3.5 unless you know you have access to version 4
    3. What is the full name of the txt file?
      • This is the name of the file excluding the path eg "myfirst.txt"
    4. What is the prompt you would like to give to openai with this file?
      • This is the instruction you are giving to gpt, eg "Please turn the following content into a script for a picth deck"
  7. The tool will then pass this data to openai and write the output to "myfirst.txt.gptoutput.txt"

Circular use - GPT talk to GPT

Try circular uses of this tool and see what you get. By this it means, taking the response from GPT and feeding it back to GPT with maybe a few altered words in the prompt.

For example...

Your first prompt could be "turn all this content into a 7 slide teaser pitch deck and give me the result in markdown syntax"

You can then pass the new file back to GPT with a new prompt "this is a 7 slide teaser pitch deck script, please provide me a more extreme example of this deck that will persuade even the toughest investor to ask for the full pitch deck and give me the output in markdown syntax"

etc etc...

The only issue with the API is that there is no memory of the previous prompts.

If anyone would like to send an option that would allow this tool to auto loop, please send in a PR :)

Want to make this better?

Open to PRs!