Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Practical Generative AI with ChatGPT

You're reading from   Practical Generative AI with ChatGPT Unleash your prompt engineering potential with OpenAI technologies for productivity and creativity

Arrow left icon
Product type Paperback
Published in Apr 2025
Publisher Packt
ISBN-13 9781836647850
Length 386 pages
Edition 2nd Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Valentina Alto Valentina Alto
Author Profile Icon Valentina Alto
Valentina Alto
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Fundamentals of Generative AI and OpenAI
2. Introduction to Generative AI FREE CHAPTER 3. OpenAI and ChatGPT: Beyond the Market Hype 4. ChatGPT in Action
5. Understanding Prompt Engineering 6. Boosting Day-to-Day Productivity with ChatGPT 7. Developing the Future with ChatGPT 8. Mastering Marketing with ChatGPT 9. Research Reinvented with ChatGPT 10. Unleashing Creativity Visually with ChatGPT 11. Exploring GPTs 12. OpenAI for Enterprises
13. Leveraging OpenAI’s Models for Enterprise-Scale Applications 14. Epilogue and Final Thoughts 15. Other Books You May Enjoy
16. Index
Appendix

Generating, optimizing, and debugging code

The primary capability you should leverage is ChatGPT code generation. How many times have you looked for a pre-built piece of code to start from? Or looked for code that could generate functions, sample datasets, SQL schemas, and so on? ChatGPT is able to generate code based on input in natural language:

Figure 5.1: Example of ChatGPT generating a Python function to write into CSV files

As you can see, not only was ChatGPT able to generate the function but it was also able to explain what the function does, how to use it, and what to substitute in generic placeholders such as my_folder.

Now let’s raise the difficulty bar. If ChatGPT is capable of generating a Python function, could it generate an entire video game as well? Let’s try. What I want to do is provide ChatGPT with an illustration of the type of game I want to develop and ask it to replicate it with code. The following is an illustration of my desired...

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 €18.99/month. Cancel anytime