AI Tools app

Our Django Boilerplate ships with a tools app, located at your_project/your_project.

This app is a good place to put your AI tool. It is already set up with a simple view and template, and it is ready to be extended with your AI tool.

(venv) interview_db $ cd interview_db/tools
(venv) tools $ tree -L 1
.
├── __init__.py
├── __pycache__
├── apis.py # This is where we handle the request from the front end and response of the API.
├── apps.py
├── gpt.py # This is where we are calling the OpenAI GPT Model and return a stream of response.
├── migrations
├── models.py
├── static
├── templates
├── urls.py
└── views.py

There is a tools.js file located at your_project/your_project/static/js. This file is where you can put your JavaScript code for your AI tool. It is already set up to be included in the base.html template.

(venv) tools $ cd static

(venv) static $ tree
.
└── js
    └── tools.js

To try out the cover letter generator, you need to also set up your OPENAI_API_KEY.

  • If you are running in local, update it in the .env file. You can get the API key from the OpenAI website.
  • If you are running in production, add it with the following command:
heroku config:set OPENAI_API_KEY=your_api_key

Then click the cover letter tool link from the header of your website to try out the cover letter generator.

Conclusion

This tutorial has focused on a small sample application, specifically a cover letter generator tool using the OpenAI GPT Model within a Django web framework. While the application itself is modest in scope, it encompasses all the fundamental concepts and steps necessary to scale up to a much larger AI-driven project.

By walking through the setup of the OpenAI API key and integrating it into our Django application, we've laid the groundwork for expanding into more complex and feature-rich AI applications. We hope this guide serves as a solid foundation for your future projects, demonstrating that even from small beginnings, ambitious AI applications can be developed. If you have any questions or would like to share your feedback, please don't hesitate to reach out. Thank you for reading, and we're excited to see what you build next!

Was this page helpful?