Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building AI Applications with ChatGPT APIs

You're reading from  Building AI Applications with ChatGPT APIs

Product type Book
Published in Sep 2023
Publisher Packt
ISBN-13 9781805127567
Pages 258 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Martin Yanev Martin Yanev
Profile icon Martin Yanev

Table of Contents (19) Chapters

Preface Part 1:Getting Started with OpenAI APIs
Chapter 1: Beginning with the ChatGPT API for NLP Tasks Chapter 2: Building a ChatGPT Clone Part 2: Building Web Applications with the ChatGPT API
Chapter 3: Creating and Deploying an AI Code Bug Fixing SaaS Application Using Flask Chapter 4: Integrating the Code Bug Fixer Application with a Payment Service Chapter 5: Quiz Generation App with ChatGPT and Django Part 3: The ChatGPT, DALL-E, and Whisper APIs for Desktop Apps Development
Chapter 6: Language Translation Desktop App with the ChatGPT API and Microsoft Word Chapter 7: Building an Outlook Email Reply Generator Chapter 8: Essay Generation Tool with PyQt and the ChatGPT API Chapter 9: Integrating ChatGPT and DALL-E API: Build End-to-End PowerPoint Presentation Generator Chapter 10: Speech Recognition and Text-to-Speech with the Whisper API Part 4:Advanced Concepts for Powering ChatGPT Apps
Chapter 11: Choosing the Right ChatGPT API Model Chapter 12: Fine-Tuning ChatGPT to Create Unique API Models Index Other Books You May Enjoy

Creating Essay Generation Methods with the ChatGPT API

In this section, we will dive into the implementation of the key functions within the essay generator application. These functions are responsible for generating the essay based on user input and saving the generated essay to a file. By understanding the code, you will be able to grasp the inner workings of the application and gain insight into how the essay generation and saving processes are accomplished.

We will begin by exploring the generate_essay() function. This function will retrieve the topic entered by the user from the input field. It will then set the engine type for the OpenAI API, create a prompt using the topic, and make a request to the OpenAI API for essay generation. The response received from the API will contain the generated essay, which will be extracted and displayed in the essay output area of the application. To add that functionality, simply remove the pass placeholder and follow this code:

def generate_essay...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}