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
5
Readme
openai-file
Table of Contents generated with DocToc
- What is this thing?
- Screenshot and some words to explain
- How to install (simple for anyone)
- How to use
- Circular use - GPT talk to GPT
- Want to make this better?
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:
- Created a folder to put my txt files in.
- Copy and pasted a load of amazon reviews from a product into a .txt file called "product-reviews.txt"
- I then opened a terminal and navigated to the folder mentioned in step 1 and ran this program by typing "openai-file"
- I followed each prompt pressing enter after each
- This program then wrote the reponse from openai to disk to a file called "product-reviews.txt.gptoutput.txt"
Try run it again with another prompt:
- With the terminal still open in the folder run the openai-file program again
- This time add a new prompt but for the same file "Write a new 5 star review"
- 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)
- Install Nodejs: https://nodejs.org/en
- Install this package globally
- Open a terminal
- Add this command and press enter:
sudo npm i -g openai-file
- It will ask for your password and then install this openai-file program for you to use
How to use
- Create a folder somewhere on your computer to contain some txt files that you want to pass to GPT
- Create a txt file eg "myfirst.txt" file
- Add some content to the txt file eg, copy and paste this readme file into it.
- Open a terminal and make sure it is at the location of your folder.
- Run the tool,
openai-file
- Answer the questions provided:
What is your openai key?
- See here to get your own API key: https://platform.openai.com/account/api-keys
openAiModel, '4' or '3.5'
- Select 3.5 unless you know you have access to version 4
What is the full name of the txt file?
- This is the name of the file excluding the path eg "myfirst.txt"
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"
- 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!