top of page

Introduction to ChatGPT's Custom Instruction



Introduction

ChatGPT is a powerful application which uses a Large Language Model which is designed to give output in the form of text based on the user instructions. When it was launched it became popular for many tasks where previously a person had to manually type text such as script writing, grammer checking, template writing, report generations, text summarization, translation and the list goes on.


After some months of public usage many limitations was found in using ChatGPT such as when we ask it perform a specific role such a script writer in the start of a conversation, it quickly forgot after having some conversations with it in a chat and we had to specify the role and other specific requirement repeatedly in all the conversations to maintain the same output format.


It is mainly happens because there is Instructions called System Message, which is sent to the Large Language Model every time along with the user instructions. So now the makers of ChatGPT OpenAI have given the user the ability to provide Custom Instructions instead of the general instruction which used to be given to the Large Language Model.


Custom Instructions

Custom Instructions are like a secret code that lets you instruct ChatGPT to follow specific guidelines while generating responses. It's like having a personalized AI assistant at your fingertips. Earlier it was predefined in the backend, But now we have the ability to set it up there by giving us the power to set it up according to any particular chat, this help us avoid the previous limitation of having to constantly mention certain specific requirements to the ChatGPT to make sure the output quality remains the same.

Setting Up

Now let us have a look at how to set up the Custom Instructions.

  • First go to https://chat.openai.com/

  • Then Make sure you have logged in if you do not have an account set up an account

  • Click the three dots in the bottom left where your email id would be displayed there you would have a option for custom Instruction as shown in the image below

  • After clicking the custom instructions you will have the following screen where in the first box we have to write instructions of how the ChatGPT should behave and in the second box we have to specific how we want the outputs and its related requirement.


Power of Custom Instructions

Now let us do a comparison on using the same well structured prompts using the Standard Instructions vs Custom Instructions to see the how the output varies.

Standard Instructions - Not a well designed prompt ->

Write a Python Function as a Professional Developer to calculate mean, median, standard deviation, and variance from a list without using external libraries.

Response ->

def calculate_statistics(numbers):
    # Calculate the mean (average)
    mean = sum(numbers) / len(numbers)

    # Calculate the median
    sorted_numbers = sorted(numbers)
    n = len(sorted_numbers)
    if n % 2 == 0:
        median = (sorted_numbers[n // 2 - 1] + sorted_numbers[n // 2]) / 2
    else:
        median = sorted_numbers[n // 2]

    # Calculate the variance
    variance = sum((x - mean) ** 2 for x in numbers) / len(numbers)

    # Calculate the standard deviation (square root of variance)
    standard_deviation = variance ** 0.5

    return {
        "Mean": mean,
        "Median": median,
        "Variance": variance,
        "Standard Deviation": standard_deviation
    }

# Example usage:
numbers = [1, 2, 3, 4, 5]
result = calculate_statistics(numbers)
print("Mean:", result["Mean"])
print("Median:", result["Median"])
print("Variance:", result["Variance"])
print("Standard Deviation:", result["Standard Deviation"])

Now we define a Custom Instruction and provide more info to the ChatGPT

Custom Information ->

You are a Professional Python Developer working in a Company in India, where you are tasked with providing help write code in Python language according to the user requirement.
The tone should be professional and the repose length can vary according to the requirement of the user. The code should be professional written in a pythonic way, functions and classes should have proper docstring to explain. The code should be well commented.

Prompt - >

Write a Python Function to calculate mean, median, standard deviation, and variance from a list without using external libraries.

Response ->

def calculate_statistics(data):
    """
    Calculate mean, median, standard deviation, and variance from a list of data points.

    Args:
        data (list): A list of numerical data points.

    Returns:
        dict: A dictionary containing the calculated statistics.
            - 'mean' (float): Mean value.
            - 'median' (float): Median value.
            - 'std_deviation' (float): Standard deviation.
            - 'variance' (float): Variance.
    """

    if not data:
        raise ValueError("Input data is empty. Please provide a non-empty list.")

    # Calculate Mean
    mean = sum(data) / len(data)

    # Calculate Median
    sorted_data = sorted(data)
    n = len(sorted_data)
    if n % 2 == 0:
        median = (sorted_data[n // 2 - 1] + sorted_data[n // 2]) / 2
    else:
        median = sorted_data[n // 2]

    # Calculate Variance and Standard Deviation
    variance = sum((x - mean) ** 2 for x in data) / len(data)
    std_deviation = variance ** 0.5

    # Create a dictionary to store the results
    statistics = {
        'mean': mean,
        'median': median,
        'std_deviation': std_deviation,
        'variance': variance
    }

    return statistics

# Example usage:
data = [12, 34, 56, 78, 90]
result = calculate_statistics(data)
print(result)

As you can see we get a much significant result this time and we did not have to mention the details such as professional developer etc... in the prompt this help us save having to repeatedly typing such information in the prompts every time we need to control the results. By using Custom Instructions we are able to better give instructions to ChatGPT to give us much better outputs.


Though this can be achieved through Prompt Engineering which is nothing but where we develop precise prompts that can improve the quality of the output we receive from apps like ChatGPT. We ourselves have a course that teaches how to develop such prompts for technical as well as non technical people who have no background knowledge in AI and Machine Learning (Click here to Check).


In Conclusion the advantage's of Custom Instructions over Prompt engineering is that:

  • More control: Custom instructions give you more control over the responses you get from ChatGPT. You can specify your preferences for the tone of voice, the topics, and the level of formality. This is not always possible with prompt engineering, which can be more limited in its scope.

  • Efficiency: Custom instructions can save you time and effort. Once you've set up your custom instructions, you can use them consistently in all of your chats with ChatGPT. This means you don't have to repeat yourself or write out long prompts every time you want to get a specific response.

  • Improved accuracy: Custom instructions can help to improve the accuracy of the responses you get from ChatGPT. By specifying your preferences, you can help ChatGPT to better understand what you're looking for and to generate more accurate responses.

  • Ease of use: Custom instructions are relatively easy to use. You can set them up in just a few minutes, and you can change them as needed. This makes them a good option for users who are not familiar with prompt engineering.

If you need any help in ChatGPT or OpenAI API related assignments or need any consultation in these area feel free to contact us at contact@codersarts.com



bottom of page