skillcrush / study-buddy

Project for the first class in the Generative AI course, a Python Study Buddy chatbot using the OpenAI API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setting up to run scripts using the openai API with Python.

The script will be run in a virtual environment. Start by creating a virtual environment:

On a Mac: python3 -m venv openai-env

On Windows: python -m venv openai-env


After creating the virtual environment, you need to activate it:

On a Mac: source openai-env/bin/activate

On Windows: openai-env\Scripts\activate


Once the virtual environment is activated, the beginning of your terminal prompt should display (openai-env).
Install the OpenAI API library by running (in both a Mac and Windows):

pip install --upgrade openai

You'll see an openai-env folder has been added to the directory with all of the installed dependencies.


Install the Flask library:

pip install flask


To run your code, in the command line run:

Without a debugger: flask run

With a debugger: flask run --debug


To stop the run, click control + C. Then hard refresh the page. When making changes to your Python, HTML, or JavaScript code (and not using debugger) you'll need to stop the run after each change.
When finished, quit the run by clicking control + C and close the virtual environment by running:

deactivate

About

Project for the first class in the Generative AI course, a Python Study Buddy chatbot using the OpenAI API.


Languages

Language:CSS 33.7%Language:Python 30.2%Language:JavaScript 24.2%Language:HTML 11.9%