Install the development version into your python environment using pip:
pip install git+https://github.com/hiroki-sawano/django-gpt-form.git
Add gpt_form
to your INSTALLED_APPS
and set OPENAI_API_KEY
to your OpenAI API key in settings.py:
INSTALLED_APPS = (
# ...,
'gpt_form',
)
OPENAI_API_KEY = '<your-api-key>'
Include gpt_form.urls
in urls.py:
urlpatterns = [
path('', include('gpt_form.urls')),
]
Load the gpt_form
tag library and use the completion_form
tag to
render the
Completion
form:
{% load gpt_form %}
{% completion_form %}
model
is set to
text-davinci-003
.OPENAI_COMPLETION = {
'model': 'text-davinci-003',
'max_tokens': 100,
'temperature': 1,
'top_p': 1,
'presence_penalty': 0,
'frequency_penalty': 0
}