Create Chatbot Based On The Data Feed By You — GPT Index/LlamaIndex| OpenAI
This article is the revised version of my previous article published here. Reason for this revision is, GPT Index is renamed to LlamaIndex. Here problem is not only renaming, lot many classes are removed, function parameters are changed and much more.
So, let’s get started.
In this article, I’ll show you how can you create a basic chat bot which utilizes the data provided by you. Here we will be using LlamaIndex, OpenAI and Python.
Let’s get started by installing the required Python module.
Install modules/packages
We need to install, two packages named gpt_index and langchain and this can be done using below lines:
pip install llama-index
pip install langchain
Importing packages
Next, we need to import those packages so that we can use them:
from llama_index import SimpleDirectoryReader,GPTListIndex,GPTVectorStoreIndex,LLMPredictor,PromptHelper,ServiceContext,StorageContext,load_index_from_storage
from langchain import OpenAI
import sys
import os
Please note that, here, we don’t need an GPU because we are not doing anything local.
Grab OpenAI Key
To grab the OpenAI key, you need to go to https://openai.com/, login and then grab the keys using highlighted way: