Thursday, 16 November 2023 11:10


Rate this item
(1 Vote)
|||||||| |||||||| ||||||||

Creating a chatbot using AI

By using Chat GPT creating a chat bot that can read documents and answer questions

Download attachments:

Additional Info

  • What you will learn:
    • Technology: Understand how AI works
    • Engineering: See some basic usage in AI
  • Expected Time:

    1 h

  • Materials & Recycled Materials:
    • - 1 computer

    •  - Internet connection

    •  - Python 3.11

    •  - Some pdf files

  • Guide:
    • Step 1

      • To start of you need to download python on your computer. This is easiest done (if you are using a windows computer) by going to Microsoft store and search for python. The program only run on 3.11 and not 3.12 so download 3.11.

      • Next step you must download some files. You will do this by opening the command prompt. If you don’t know how to do this, you can do this by using the window button on your keyboard + R. This will open a new window for you. In that window you write CMD. This will open a new window for you.  In this window you will write following command to install the needed files.  Write one line at the time then hit enter. It will then install the files. Do this for all of them.

      • pip3 install llama-index

      • pip3 install pypdf

      • pip3 install openai

      • pip3 install streamlit

      • pip3 install nltk

    • Step 2

      •  Download the folder chatbot_thinkerlab. You have to unzip the folder. I highly recommend placing the folder strait on the c drive or the desktop. Otherwise it will more complicated to find the files later on.

    • Step 3

      •  If you put the file directly on the C drive do the following:

      •  in the command prompt write cd.. this will move you down on step. Repeat this until it only says C:\. When you reached this level now write dir. This command will show all the files in this directory. Hopefully you will find the chatbot here. If so write cd chatbot. Then cd chatbot.

      •  Now write the command

      •  python3 -m streamlit run hopefully the program will start in a new window in your web browser.

      •  Now you can ask the bot a question and see what happens.

    •  Step 4

      •  As you probably seen by now the knowledge of this bot is very limited. If you want to add information to its knowledge, you can do that. This is done by adding either .text file or pdf file in the folder data. You only need to place it there and then re-run the app in the command prompt. The quickest way to close the program is by using Ctrl + c. That command will close the program. Then to restart it just use the up arrow.

    •  Step 5

      •  After you been playing around with what you can ask the bot, why not have some fun with the code of the bot? You can access the code by open the open the file called app with the notepad. Now you can change the code to your liking. But even better if you open it in a program like visual code or similarly.

  • Further Steps:

    Try to add functionality to the program. What happens if you change settings like temperature?

  • Difficulty level: Medium
  • Developed By: GTC - SW


No media available for this project

Read 67 times Last modified on Monday, 20 November 2023 10:23

Add comment

WARNING! If you add a comment you accept the privacy policy!

Security code