AI prompts
base on ChatGPT-based reddit profile analyzer. BYO api key # Reddit Profile Analyzer
A ChatGPT-based Reddit profile analyzer. (Bring your own API key.)
This script will input comments obtained from redditcommentsearch.com and perform a psychological profile analysis on the redditor in question. It does this by breaking the comments into chunks and performing several individual analyses, then synthesizing the result into one single analysis.
The prompts located in the main.py script file guide this process and can be tuned to preference, most notably to affect what categories are analyzed. ("Freeform" analysis produced wildly inconsistent results, so some imposition of structure like categories is recommended to make sure all of the chunk analyses are comparable to each other.)
## Instructions (For the Complete Newbie)
> Note: For each of these instructions, ask ChatGPT how to do it! It's super informative. Simply copy the instruction you're not sure about, paste it into ChatGPT, and ask "How do I do this?". It will provide you with detailed step-by-step instructions.
### 1. Get an API key for ChatGPT.
You'll need to do this from your OpenAI account website, see their site for details. You will be billed to use this script, but it will be on the order of like...$0.10 for an average profile with several hundred comments. It cost me a couple bucks to do two dozen profiles when I posted on reddit with the script and offered to do profiles for people.
### 2. Install Python.
Install any version of Python and make sure to set up your environment variables to use the command line commands.
### 3. Install Necessary Packages
Install the required packages using the following command line prompts:
```sh
pip install openai
pip install pandas
pip install beautifulsoup4
```
### 4. Clone this Repository
Check out this repo and save it to a local folder.
> You may want to check out the prompts in main.py, I put the instructions near the top so they're easier to edit. In particular, I had both the chunk analysis and the synthesis scripts structure their output into specific categories that came up on the two dozen samples I ran on reddit. You can tailor these instructions to your preference.
### 5. Create API Key File
In this folder, create the file "chatgpt_api_key.txt" and enter your API key as the file's content.
> Security Note for Newbies: This is a very dangerous thing to do for an unknown script, because I *could* be a malicious actor who is stealing API keys and sending them to myself so I can run up your bill. You need to make sure you open and review the two script files to make sure that's not what I'm doing! (You will notice that the only place the API key is actually loaded is in chat_gpt_core.py at the top of the script, where it is assigned to openai.api_key, which is necessary for the openai package to run.)
### 6. Search for all comments from the target profile
Visit https://redditcommentsearch.com/ and type the username you want to summarize (you're only doing this for your own profile, riiiiight?) and click 'Search'.
### 7. Save the HTML File
Once all the results have loaded, save the HTML file and rename it to `{username}.html` (e.g., "grays42.html"). You can delete the folder containing extra files after renaming. Place the html file inside your directory.
### 8. Check your files.
You should now have four files in your directory:
- `main.py`
- `chatgpt_core.py`
- `chatgpt_api_key.txt`
- `yourusername.html`
### 9. Run the script!
Open a command line in this directory (if you're in Win10 or Win11, type "cmd" into the address bar and it will pull right up) and run the following command: "python main.py yourusername" (e.g. "python main.py grays42")
- As individual analyses are performed, they will output to the command line. Each will take about 30 seconds to run.
- When the final analysis outputs, it will be located in the folder as "yourusername_synthesized_profile.txt".
### Get an error?
Paste it to ChatGPT! ChatGPT is fantastic at figuring out where errors are coming from and telling you how to fix them. You *should* only encounter errors like missing packages and the like, but if something big breaks (like redditcommentsearch.com changes their format) reach out to me to fix it.
I don't use github hardly at all except to post a script occasionally, so if you really need to contact me just message me on reddit at /u/Grays42.
Enjoy!
", Assign "at most 3 tags" to the expected json: {"id":"1975","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"