How to build a custom ChatGPT with your own data

Offering GPT technology in a powerful and easy-to-use chatbot, ChatGPT has become the world's most popular AI tool. Many people use ChatGPT to provide engaging conversations, answer queries, offer creative suggestions, and assist with code generation and writing. However, ChatGPT is limited as you cannot store your data for long-term personal use and the knowledge data cut-off point is September 2021.

An alternative is to use OpenAI and LangChain's APIs to provide ChatGPT with custom data and updates by 2021 to create a custom instance of ChatGPT.

Step 1: Install and download pre-made software and scripts

Please note that the following instructions are for Windows 10 or Windows 11 machines.

To provision custom data for ChatGPT, you need to install and download the latest Python3, Git, Microsoft C++ and ChatGPT-retrieval script from GitHub. If you have some software installed on your PC, make sure that they are updated to the latest version to avoid any hiccups in the process.

Start by installing:

  1. (Free of charge)
  2. (Free of charge)
  3. (Free of charge)

Python3 and Microsoft C++ installation notes

When installing Python3, make sure you tick the Add python.exe to PATH option before clicking Install Now . This is important because it allows you to access Python in any directory on your computer.

How to build a custom ChatGPT with your own data Picture 1

 

When installing Microsoft C++, you will want to install the Microsoft Visual Studio Build Tools first. After installation, you can check the option Desktop development with C++ and click Install with all optional tools automatically selected on the right sidebar.

How to build a custom ChatGPT with your own data Picture 2

Now that you have the latest versions of Python3, Git, and Microsoft C++ installed, you can download Python scripts to easily query custom local data.

  1. (Free of charge)

To download the script, click Code , then select Download ZIP . This will download the Python script to your default or selected directory.

How to build a custom ChatGPT with your own data Picture 3

 

Once downloaded, you can now set up the local environment.

Step 2: Set up the local environment

To set up the environment, you need to open a terminal in the chatgpt-retrieval-main folder you downloaded. To do that, open the chatgpt-retrieval-main folder , right-click and select Open in Terminal .

How to build a custom ChatGPT with your own data Picture 4

Once the terminal is open, copy and paste this command:

pip install langchain openai chromadb tiktoken unstructured

This command uses Python's package manager to create and manage the required Python virtual environment.

After creating the virtual environment, you need to provide the OpenAI API key to access their services. First, you need to generate an API key from the OpenAI API key website by clicking Create new secret key , adding a name for the key, then pressing the Create secret key button .

How to build a custom ChatGPT with your own data Picture 5

 

You will be provided with a string of characters. This is your OpenAI API key. Copy it by clicking the copy icon next to the API key. Please note that this API key must be kept secret. Do not share it with others unless you really intend to let them use the same key with you.

After copying, go back to chatgpt-retrieval-main folder and open constants with Notepad. Now replace the placeholder with your API key. Remember to save the file!

How to build a custom ChatGPT with your own data Picture 6

You have now successfully set up your virtual environment and added the OpenAI API key as an environment variable. You can now provide your custom data to ChatGPT.

Step 3: Add custom data

To add custom data, put all your custom text data in the data folder in chatgpt-retrieval-main. The format of the text data can be PDF, TXT or DOC.

How to build a custom ChatGPT with your own data Picture 7

As you can see from the screenshot above, the example has added a text file containing a pre-made personal schedule, an article written about AMD's Instinct AI Accelerators, and a PDF document.

Step 4: Query ChatGPT via Terminal

Python scripts allow you to query data from custom data added to the data directory and the Internet. In other words, you will have access to the regular ChatGPT backend and all data is stored locally in the data directory.

To use the script, run the python chatgpt.py script and add your question or query as an argument.

python chatgpt.py "YOUR QUESTION"

Make sure to put your question in quotes.

To check if your ChatGPT data has been successfully provided, the example will ask a personal question regarding the Personal Sched.txt file.

 

How to build a custom ChatGPT with your own data Picture 8

Everything works! This means that ChatGPT can read the previously provided Personal Sched.txt. Now, see if you have successfully provided information that ChatGPT is unaware of due to its knowledge cut-off date.

How to build a custom ChatGPT with your own data Picture 9

As you can see, it accurately describes the AMD Instinct MI250x, which was released after the ChatGPT -3 knowledge cut-off date.

4 ★ | 1 Vote

May be interested

  • How to register for ChatGPT's new plugin featureHow to register for ChatGPT's new plugin feature
    chatgpt plugins are software components integrated into the chatgpt platform. they provide chatgpt with additional information and allow chatgpt to perform specific actions on the user's behalf.
  • What is ChatGPT Plus? How to register ChatGPT Plus in VietnamWhat is ChatGPT Plus? How to register ChatGPT Plus in Vietnam
    according to new information, chat gpt plus has now been deployed in the vietnamese market so that we can buy and register our accounts, without expecting vpn software or using another phone number to register to use chat gpt like now.
  • How to Use ChatGPT Search Like a ProHow to Use ChatGPT Search Like a Pro
    whether you're troubleshooting a technical issue or digging deep into research, chatgpt search can be surprisingly effective.
  • 9 ChatGPT and Generative AI API alternatives for developers9 ChatGPT and Generative AI API alternatives for developers
    when one tool takes center stage, it's easy to overlook alternatives that could offer equal or even better value. tipsmake.com.com has compiled 9 best chatgpt alternatives that you can use right now.
  • Is ChatGPT accessible with a VPN?Is ChatGPT accessible with a VPN?
    although chatgpt is currently a popular ai tool, it is not welcomed everywhere. this ai chatbot has been banned in several countries, meaning people cannot access and use its features.
  • Compare ChatGPT 4o and ChatGPT 4Compare ChatGPT 4o and ChatGPT 4
    openai recently announced its end-to-end multimodal model, chatgpt 4o, and made it freely available to everyone. not only that, free users also get many premium features previously exclusive to chatgpt plus users.
  • Does ChatGPT have privacy issues?Does ChatGPT have privacy issues?
    chatgpt and its developer openai have received heavy criticism from governments, privacy experts, and users concerned about their data retention policies. so what does an ai chatbot really know about you and what does it use this information for?
  • 4 ways to use ChatGPT to manage time4 ways to use ChatGPT to manage time
    in addition to the ability to create documents, chatgpt can also help you become more productive and efficient with effective time management skills.
  • Why were new ChatGPT registrations stopped? When will it reopen?Why were new ChatGPT registrations stopped? When will it reopen?
    openai ceo sam altman has officially revealed that registration for the flagship generative ai tool has ended - at least for now.
  • 9 useful Chrome extensions for ChatGPT9 useful Chrome extensions for ChatGPT
    chatgpt is super hot lately, allowing you to find information about just about anything out there. if you're a chrome user, you'll be happy to know that there are many extensions that provide additional features for chatgpt right in your browser.