This guide will walk you through setting up a chatbot using FastAPI and the OpenAI API.
Create a new folder on your computer where you will store your chatbot project.
Open Visual Studio Code and use the Open Folder option to open the newly created folder.
In the VS Code command bar, select Terminal. If you don't see it, click on the ... menu to find the terminal option.
Click New Terminal. A terminal window will open at the bottom of VS Code.
Run the following commands one at a time in the terminal to create and activate a virtual environment:
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
.\venv\Scripts\activate
# Activate the virtual environment
source venv/bin/activatepip install fastapi uvicorn openai websockets- Open Terminal/Command Prompts
- Navigate to desired directly (don't create the simple-chatbot directory git clone will do it for you)
- Use the git clone command (copy this command)
git clone https://github.com/marty916/simple-chatbot.git- After cloning, navigate into the newly created directory
cd simple-chatbotIf you don't have Git installed
- Click on the 'Code' button above
- Save the ZIP file to the desired location
- Extract the ZIP file to your desired directory