AI Automation: Automate 9 Tasks with Python & ChatGPT

Using AI Automation + Python + ChatGPT APIs you want to automate things? Like summarizing a blog post? or summarizing YouTube videos? or Convert blogs to tweets? or Search for Ideas? etc.

Requirements For AI Automation

Yes. you can do this using LLM like ChatGPT APIs and Python. But there are some requirements, below there are three lessons I mentioned. You must read that before you can automate tasks.

Now let’s jump to AI automation to automate tasks.

Summarization Blog Post

So, why do we need summarization? 🤔 Well, in today’s information age, there’s more content than we could ever hope to read. Summarization helps us compress that mountain of data into manageable, bite-sized chunks. And who doesn’t love bite-sized chunks, right?

Here is a sample prompt to summarize any text:

Your task is to create a concise summary
of the provided text.

I want you to remember the following information: When it comes to writing content,
two factors are crucial, "perplexity" and "burstiness."
Perplexity measures the complexity of text. Separately,
burstiness compares the variations of sentences.

Your summary should adhere to the given bullet points number.

Please format your response as bullet points. and add emojies when relevant

Minimum Number of Bullet Points: [{Minimum}]
Maximum Number of Bullet Points: [{Maximum}]
Provided Text: [{Text}]

ChatBot in ai automation

Let’s Chat with AI! 🤖💬

In this section, we’re going to go into Conversations. Yes, you heard that right! We’re going to have a chat with our AI buddy.

Conversational AI is the magic behind chatbots, personal assistants, and customer service bots. With conversational AI, we can have a two-way interaction, ask follow-up questions, and get responses.

Below I provided Python code, put in visual studio code in Python, and make sure to replace the API openAI key with yours. Run the application. Talk with bot in terminal.

import openai

openai.api_key = "sk-Mt9bKcl5G0ePuQxCqATAjT3BlbkFJZMrNYkzaesj0pQDO8iem"

selected_model = "gpt-3.5-turbo"
# Initialize the list of messages
messages = [{"role": "system", "content": "You are a helpful assistant."}]


# Start a chat
def continue_chat(user_message):
    # Add the user's message to the list
    messages.append({"role": "user", "content": user_message})

    # Get the chat response
    response = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",  # or gpt-4 if available
        messages=messages,  # the list of all messages
    )
    # Add the AI's response to the list
    messages.append(
        {"role": "assistant", "content": response.choices[0].message["content"]}
    )

    return response.choices[0].message["content"]


# Chat with the bot
while True:
    user_message = input("You: ")
    if user_message.lower() == "quit":
        break

    ai_response = continue_chat(user_message)
    print("AI: ", ai_response)

Text Classification

Sorting Things Out with AI! 🗂️🤖

We’re diving into Text Classification – a super useful way to sort and categorize text. It’s like putting your laundry into different baskets – only much more fun, and with fewer socks to match!

Text classification is the process of assigning categories, tags, or labels to text, making it a lot easier to manage and analyze. It’s widely used in spam filtering, sentiment analysis, topic labeling, and more! Imagine an email inbox that automatically sorts your emails into different categories

And there you have it! You’ve successfully categorized sentences with AI! 🎉 But remember, our AI buddy’s performance depends on the prompts we provide. So always be clear and specific in your instructions!

Sample Classification Prompt:

Your task as a text analyzer is to classify a given sentence into one of the specific categories: 'food', 'sports', or 'business'. In doing so, you must carefully consider the main theme and context of the sentence. Your response should clearly communicate your classification choice for the sentence and provide a brief explanation that highlights key elements, such as words or phrases, that support your decision.

Please note that your analysis should be adaptable, flexible, and capable of addressing a wide range of sentence types and structures. Your objective is to deliver a precise, accurate, and insightful categorization that demonstrates an in-depth understanding of the main theme and context of the sentence while focusing on the designated categories.

Input Sentence: 

Generate Ideas in AI Automation

Spawning Ideas with AI! 💡🤖

In this lecture, we’re exploring the world of General Text Generation with AI and we will practice it with Idea Generation.

It’s like having a brainstorming buddy who’s ready to churn out ideas on demand! Cool, huh? 😎

AI can help us generate names, titles, slogans, and even domain names. It can be super handy when you’re starting a new business, launching a new product, creating content, or need a creative kick-start. Imagine having an assistant that can provide you with unique and catchy domain name suggestions for your new website.

Sample Prompt To Generate Domain Name Ideas:

Generate 10 original and creative .com domain names tailored to a specific niche and provide a brief explanation (1-2 sentences) for each domain name, explaining its relevance and appeal to the niche. Include popular keywords associated with the niche in your explanation to enhance marketability. The niche you'll be focusing on is [Niche].

Please ensure the domain names can feature a combination of words and numbers, allowing for unique and memorable options. Emphasize creating domain names that are engaging, relevant, and aligned with the target audience's interests. Also, consider how each domain name could benefit and resonate with the target audience. Remember to aim for creativity and flexibility in your domain name selections.