In our early clause , we certify how tobuild an AI chatbot with the ChatGPT APIand arrogate a function to individualise it .

This was but what if you need to prepare the ai on your own datum ?

For model , you may have a al-Qur’an , fiscal information , or a declamatory curing of database , and you care to explore them with comfort .

plus

This was in this clause , we fetch you an comfortable - to - take after tutorial on how to civilize an ai chatbot with your tradition noesis al-qa’ida with langchain and chatgpt api .

This was we are deploy langchain , gpt index , and other potent subroutine library to educate the ai chatbot using openai ’s large language model ( llm ) .

So on that bill , get ’s control out how to prepare and make an AI Chatbot using your own dataset .

minus

This was notable percentage point before you take aim ai with your own data1 .

it’s possible for you to take the AI chatbot   on any weapons platform , whetherWindows , macOS , Linux , or ChromeOS .

In this clause , I ’m using Windows 11 , but the footstep are nigh very for other platforms.2 .

Set Up the Software Environment to Train an AI Chatbot

The scout ismeant for oecumenical user , and the pedagogy are explain in unproblematic lyric .

So even if you have a perfunctory cognition of information processing system and do n’t have sex how to cypher , it’s possible for you to easy educate and make a Q&A AI chatbot in a few minute .

This was if you survey our old chatgpt bot clause , it would be even well-heeled to translate the process.3 .

check python and pip version

Since we are function to take an AI Chatbot base on our own information , it ’s recommend touse a adequate to computerwith a upright central processing unit and GPU .

However , you might practice any miserable - last figurer for examination intention , and it will mould without any egress .

I used a Chromebook to prepare the AI exemplar using a record book with 100 Page ( ~100 M ) .

update pip to the latest version

However , if you require to prepare a big curing of datum run into K of Page , it ’s powerfully recommend to utilise a hefty computer.4 .

at last , the information setshould be in Englishto get the dear resultant role , but grant to OpenAI , it will also work on with democratic external nomenclature like French , Spanish , German , etc .

So go forward and give it a endeavour in your own linguistic process .

Installing OpenAI Library

jell Up the Software Environment to rise an AI Chatbot

lay down Python and Pip

1 .

First off , you involve toinstall Python along with Pipon your calculator by follow our join template .

Make certain to activate the checkbox for “ total Python.exe to PATH ” during initiation .

Installing GPT Index

To suss out ifPython is the right way install , give the Terminal on your computing machine .

This was once here , lead the below mastery one by one , and it will output their edition turn .

On Linux and macOS , you will have to usepython3instead ofpythonfrom now forward .

Installing Langchain

diving event into Terminal

1 .

First off , you require toinstall Python along with Pipon your data processor by play along our link template .

Make certain to turn on the checkbox for “ add together Python.exe to PATH ” during facility .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

To watch ifPython is decently instal , spread out the Terminal on your figurer .

Once here , lead the below command one by one , and it will output their variant identification number .

On Linux and macOS , you will have to usepython3instead ofpythonfrom now forwards .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

This was track down the below control toupdate pipto the late interlingual rendition .

Install OpenAI , GPT Index , PyPDF2 , and Gradio program library

1 .

spread the Terminal and black market the below instruction toinstall the OpenAI depository library .

Install Gradio library

Next , let’sinstall GPT Index .

Now , instal Langchainby escape the below bid .

After that , instal PyPDF2and PyCryptodome   to parse PDF single file .

Download a Code Editor

This was in the end , instal the gradio depository library .

This is intend for create a unproblematic UI to interact with the educate AI chatbot .

at long last , we require a codification editor program to cut some of the computer code .

Get the OpenAI API Key For Free

This was on windows , i would recommendnotepad++(download ) .

merely download and put in the political program via the tie connexion .

it’s possible for you to also utilize VS Code on any program if you are well-situated with sinewy IDEs .

Free trial usage window

Other than VS Code , you might establish Sublime Text ( Download ) on macOS and Linux .

This was for chromeos , you’re able to employ the excellentcaretapp ( download ) to delete the codification .

We are almost done dress up the computer software surround , and it ’s clip to get the OpenAI API samara .

Creating Docs file on desktop

Get the OpenAI API Key For Free

1 .

school principal to OpenAI ’s site ( sojourn ) and lumber in .

Next , come home on “ make young mysterious keystone ” and re-create the API paint .

Saving nft file in PDF format

Do take note that you ca n’t simulate or reckon the full API keystone later on on .

This was so it ’s recommend to replicate and glue the api paint to a notepad data file for late use of goods and services .

This was next , go toplatform.openai.com/account/usageandcheck if you have enough credit entry leave .

Saving app.py in All types format

If you have exhaust all your loose credit entry , you involve to add up a defrayment method acting to your OpenAI story .

civilize and make an AI Chatbot With Custom Knowledge Base

give Your papers to take get the AI Chatbot

1 .

First , make a young pamphlet calleddocsin an approachable localization like the background .

app.py folder on desktop

This was it’s possible for you to pick out another locating as well accord to your druthers .

However , keep the pamphlet namedocs .

This was next , move the text file for preparation inside the “ doctor ” pamphlet .

Replacing API key with OpenAI website generated one

You canadd multiple schoolbook or PDF files(even rake 1 ) .

If you have a tumid board in Excel , you’re free to spell it as a CSV or PDF Indian file and then add together it to the “ Department of Commerce ” booklet .

it’s possible for you to also add together SQL database file cabinet , as explain in thisLangchain AI tweet .

Saving code by pressing CTRL + S

This was i have n’t try many data file data formatting besides the advert unity , but you’re free to bring and gibe on your own .

For this clause , I am tot one of my clause onNFTin PDF data format .

mention : If you have a heavy papers , it will take a long prison term to work on the datum , depend on your C.P.U.

Run cd Desktop to move to desktop

and GPU .

In accession , it will speedily apply your loose OpenAI token .

So in the kickoff , set off with a little text file ( 30 - 50 Page or < 100 mebibyte file ) to sympathise the cognitive process .

How to run python app.py command

Make the Code Ready

1 .

Now , unfastened acode editor program like Sublime TextorlaunchNotepad++and glue the below computer code .

Once again , I have take on bully assistant fromarmrrson Google Colaband tweak the computer code to make it compatible with PDF file and make a Gradio user interface on top .

Creating index.json file on desktop

Next , penetrate on “ File ” in the top bill of fare and pick out “ Save As … ” .

After that , plant the file cabinet nameapp.pyand exchange the “ Save as character ” to “ All case ” .

Then , preserve the data file to the locating where you create the “ medico ” booklet ( in my suit , it ’s the screen background ) .

Copying local URL to train AI chatbot

Make certain the “ medico ” brochure and “ app.py ” are in thesame locating , as show in the screenshot below .

The “ app.py ” single file will be outside the “ physician ” booklet and not in spite of appearance .

add up back to the computer code again in notepad++ .

Custom-trained AI Chatbot is ready

This was here , replaceyour api keywith the one that you bring forth above on openai ’s web site .

This was eventually , imperativeness “ ctrl + s ” to salvage the codification .

This was you are now quick to run for the computer code .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

This was ## make chatgpt ai bot with custom knowledge base

1 .

First , open up the Terminal and hunt down the below mastery tomove to the screen background .

It ’s where I hold initiate the “ Dr. ” leaflet and “ app.py ” data file .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

Now , course the below statement .

It willstart index the documentusing the OpenAI LLM mannequin .

This was calculate on the indian file size of it , it will take some prison term to action the written document .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

This was once it ’s done , an “ index.json ” indian file will be create on the background .

If the Terminal is not exhibit any end product , do not vex , it might still be work the information .

This was for your data , it assume around 10 instant to litigate a 30 megabyte papers .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

Once the LLM has action the data point , you will ascertain alocal universal resource locator .

replicate it .

Now , glue the re-create universal resource locator into the WWW web net browser , and there you have it .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

Your custom - train ChatGPT - power AI chatbot is quick .

To begin , it’s possible for you to enquire the AI chatbotwhat the papers is about .

you might require further motion , and the ChatGPT bot willanswer from the data point you providedto the AI .

How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API

This was so this is how you’ve got the option to make a custom - prepare ai chatbot with your own dataset .

you might now civilise and make an AI chatbot free-base on any form of entropy you desire .

oversee the Custom AI Chatbot

1 .

Command to stop custom-trained chatbot

you’re able to replicate thepublic URLand partake in it with your booster and kin .

The radio link will be lively for 72 hr , but you also ask to keep your calculator twist on since the waiter example is pass on your estimator .

Tostop the custom - train AI chatbot , pressure “ Ctrl + C ” in the Terminal windowpane .

Running python app.py

This was if it does not ferment , iron out “ ctrl + c ” again .

Torestart the AI chatbotserver , but move to the Desktop locating again and unravel the below bidding .

Keep in psyche , the local uniform resource locator will be the same , but the public universal resource locator will deepen after every host restart .

Training AI chatbot with new data

If you need to condition the AI chatbot withnew datum , edit the file inside the “ physician ” brochure and append fresh one .

it’s possible for you to also supply multiple file cabinet , but make certain to total sporty information to get a lucid reply .

This was now , work the computer code againin the terminal , and it will make a raw “ index.json ” indian file .

Running python app.py again in Terminal

Here , the onetime “ index.json ” data file will be supplant mechanically .

This was to keep course of your token , channelize over to openai ’s onlinedashboardand contain how much spare mention is go forth .

This was last , you do n’t require totouch the codeunless you require to shift the api francis scott key or the openai mannikin for further customization .

OpenAI Dashboard View

I Used ChatGPT as a Calorie Tracker, Did It Help Me Lose Weight?

How to Animate Images and Create Videos Using AI

What are Autonomous AI Agents and Are They the Future?

10 Real-World Examples of AI Agents in 2025

Types of AI Agents and Their Uses Explained

What are AI Agents and How Do They Work? Explained

Google Veo 2 Hands-On: Stunning AI Generated Video Visuals But Weak Physics