Skip to content
site logo mobile

ChatGPT + Python Chaining: One-Minute Hack Saves 10 Hours of Work!

Table of Contents

You are using ChatGPT the Wrong way or at least missing The Real Power of ChatGPT when combined with Chaining.

I wish every ChatGPT user read and try what is covered in this post.

chatgpt python chaining post

What is a ChatGPT Chain?

I think the best way to understand this concept is by showing a practical example.

Let’s assume that you are a YouTuber! and you have the video production workflow as follows:

Topic -> Title Ideas -> Thumbnail Ideas -> Script -> Record -> Edit -> Publish -> Promote.

💡 By the way, I am a YouTuber, and here is my Ad-Free Channel if you wanna take a look. I share videos to help you 10X your marketing and online business with the Power of AI, ChatGPT,  Automation, and Python.

Anyway, this YouTube workflow usually takes an average of 10–30 hours, depending on the channel. For me, it takes around ~10 hours.

Let’s forget about recording and editing tasks for now, as they are out of scope in our case here; the other tasks will take like 3-5 hours.

So, in short, we want to cut down the time to 1 hour or less with the help of ChatGPT, and here are the main tasks that we have in our workflow:

Topic > Title Ideas > Thumbnail Ideas > Script > Promote.

You may tell me with some advanced ChatGPT prompts, chat with ChatGPT, and other YouTube AI tools Like PromoterKit. We can save time doing all this!

Yeah, maybe you are right! But it is not the best approach. We want something more powerful and stable!

And Remember that we are talking about a specific scenario here (the YouTube workflow) with 4–5 tasks.

We may have 20, 50, or even 100 Tasks in other workflows and scenarios! I will show you another example later in this post.

So I don’t think you want to go to ChatGPT every time and Start Chatting and asking for 50 or 100 tasks. Memorize the same prompts; maybe ChatGPT is down sometimes. It will probably take more time than the manual process! 🧐

So the idea is to create what we call an “Automated-GPT-Chaining” Python Script.

Did you hear about Langchain or AutoGPT? It is something similar but way simpler and targeted to a specific scenario to achieve the best results.

If you didn’t hear about it, no worries. We are not using them here anyway 🙂

💡I am building a new GPT Library (Called OneShotGPT) I am planning to make it super powerful and super easy to use.Get notified When it is live by joining my newsletter here.

Running The Script 

Let me show you the power of this simple chaining technique in this 28 seconds demo video:

Cool Ha!

The Power of this script

So What is behind this script?

There are 4 main aspects of this project:

1- Advanced Prompts

If you open the prompts.py file, you will find a list of prompts used. Feel free to customize and test if you want. These are the prompts used in our case to help generate ideas, script, and other stuff.

prompts chatgpt youtube.png

And these prompts must be customized based on your workflow (we will have an example later in this post)

2- Automation:

You don’t need to go every time and ask ChatGPT for each task manually. Everything is automated in 1 click!

Since this Python script runs automatically, you will not worry about memorizing prompts, opening ChatGPT every time, and chatting with it. All this will be automated, and you will get the results in less than 30 seconds.

3- Chaining:

Here is the core part. If you check the main script file, you will see that we are chaining the outputs. For example, the output of the first task (title ideas) is the input of the second (thumbnail ideas).

And the output of the third task (script) is the input of the fourth task (creating a Twitter thread). And so on.

This idea is very important as we are automatically feeding the results and building on top of it!

Take a look at the code

4- Simplicity:

This script is not written in the best way in terms of best practices. I made it like this to keep it simple for beginners. So anyone can edit and customize based on their specific workflow. 

Setup The Script

It is very easy to set up and run this script. All you need to do is. Download the script files. Install python. Install required modules. And run!

1- Get The Script

Click here to download the project files. Or check the source on GitHub here.

2- Install Python

Go to Download Python | Python.org and download the setup file. Run it and make sure to tick the “Add Python to Path” checkbox.

3- Install the required modules.

Just open any terminal like Powershell or terminal inside visual studio code, and run the following command:

pip install openai

4- Set OpenAI API Key

Open the [chat_gpt_api.py] File, and paste the OpenAI key from your account.

python openai api key

5- Run the script file

In the downloaded project folder, you will find a batch file called “run-me.bat.” Double-click to see the magic.

python chatgpt script.png

Customize The Script.

In the prototype discussed above, we went through the Youtube production workflow.

What if you want to customize it for something else? Add more tasks? 

Let’s see a simple example of how to do that.

Let’s say you are a blogger, and you have this workflow:

Topic -> SEO Optimized Titles -> Writing The Blog -> Convert Into Twitter Thread

First, you will need to change the prompts; for example, a prompt that generates SEO optimizer Titles is:

I want you to act as a professional blog title generator. Think of titles that are SEO optimized and attention-grabbing at the same time, and will encourage people to click and read the blog post. They should also be creative and clever. Try to come up with titles that are unexpected and surprising. Do not use titles that are too generic, or titles that have been used too many times before. I want to generate 5 to 7 titles maximum. My blog post is about [Topic]

I use this prompt currently in my Free AI Title Generator tool on PromoterKit.

And then change the main script file to use these prompts instead.

chatgpt prompts.png

You may be thinking now. I need to learn Python, prompt engineering, and some other tech skills!

Why not! Come on; we are in 2023. Wake up!

And the good news is: I am here to help 🙂

Check my free courses on my YouTube Channel (No Disturbing Ads, No Signups). Just click and learn. You can thank me by sharing this post and helping others 🙂 And don’t forget to read the Quote Below ☟

Today’s Quote:

Invest in your self. it is the best investment you will ever do!

If you have any questions, I am here to help, waiting for you in the comments 🙂

28 thoughts on “ChatGPT + Python Chaining: One-Minute Hack Saves 10 Hours of Work!”

  1. Thanks very much . can you help us with a prompt to do literature review on a specific topic. ChatGPT have some times problems to enter databases like google scholar

  2. Love from India broo..
    Your efforts are outstanding and your explanation is miraculous..
    Continue the spirit brother…

  3. Hi Hassan…

    I am new to blogging and I am learning so much from you.

    I am a little in the dark on this post and python and the rest, but I am however ready to learn.

    Is it possible to make a video on the installation as you have explained it.
    I have a MacBook pro, please take this into consideration.

    Thanks and Regards

    Ephron

  4. Hi Hasan!

    Thank you for the video! I am trying to do it on my own and I seem to be running a trouble on Visual studio, whenever I follow step 3 from the mentioned above the “modules” im having an error that says, “The term pip is not recognized”.

  5. Thank you very very much Mr. Hasan you are a genius man, with this post or script I’ll make WordPress checklist, to design new wordpress websites without forgeting anything like before in designing my websites, if you have any suggestions about my idea you can reply to this comment. Thank you very much again, I appreciate it.

Leave a Reply

Your email address will not be published. Required fields are marked *