This is a code repository for a Django web development project that integrates the OpenAI API. It provides a step-by-step guide on how to use the OpenAI API in a Django application to build intelligent chatbots and other interactive features.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
You will need to have the following software installed on your machine:
- Python 3
- Django
- openai
You will also need to sign up for an OpenAI API key at https://beta.openai.com/.
To set up the Django project on your local machine, follow these steps:
- Clone the repository:
$ git clone https://github.com/acaiaworld/django-openai.git
$ cd django-openai
- Create a virtual environment to install dependencies in and activate it:
$ virtualenv2 --no-site-packages env
$ source env/bin/activate
- Install the required Python packages:
(env)$ pip install -r requirements.txt
Note the (env)
in front of the prompt. This indicates that this terminal
session operates in a virtual environment set up by virtualenv2
.
-
Set up your OpenAI API key in the openai.api_key.set() function in mychatbot/views.py.
-
Run the Django development server:
(env)$ cd project
(env)$ python manage.py runserver
- Navigate to http://127.0.0.1:8000/ in your web browser to view the chatbot interface.
- Django - The web framework used
- OpenAI API - Advanced machine learning models
ACAIA 2023 - @ACAIA - info@acaiaworld.com
ACAIA Website: https://www.acaiaworld.com/