Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
AI-Assisted Programming for Web and Machine Learning

You're reading from   AI-Assisted Programming for Web and Machine Learning Improve your development workflow with ChatGPT and GitHub Copilot

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781835086056
Length 602 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (5):
Arrow left icon
Marina Fernandez Marina Fernandez
Author Profile Icon Marina Fernandez
Marina Fernandez
Ajit Jaokar Ajit Jaokar
Author Profile Icon Ajit Jaokar
Ajit Jaokar
Anjali Jain Anjali Jain
Author Profile Icon Anjali Jain
Anjali Jain
Christoffer Noring Christoffer Noring
Author Profile Icon Christoffer Noring
Christoffer Noring
Ayşe Mutlu Ayşe Mutlu
Author Profile Icon Ayşe Mutlu
Ayşe Mutlu
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (25) Chapters Close

Preface 1. It’s a New World, One with AI Assistants, and You’re Invited FREE CHAPTER 2. Prompt Strategy 3. Tools of the Trade: Introducing Our AI Assistants 4. Build the Appearance of Our App with HTML and Copilot 5. Style the App with CSS and Copilot 6. Add Behavior with JavaScript 7. Support Multiple Viewports Using Responsive Web Layouts 8. Build a Backend with Web APIs 9. Augment Web Apps with AI Services 10. Maintaining Existing Codebases 11. Data Exploration with ChatGPT 12. Building a Classification Model with ChatGPT 13. Building a Regression Model for Customer Spend with ChatGPT 14. Building an MLP Model for Fashion-MNIST with ChatGPT 15. Building a CNN Model for CIFAR-10 with ChatGPT 16. Unsupervised Learning: Clustering and PCA 17. Machine Learning with Copilot 18. Regression with Copilot Chat 19. Regression with Copilot Suggestions 20. Increasing Efficiency with GitHub Copilot 21. Agents in Software Development 22. Conclusion 23. Other Books You May Enjoy
24. Index

Understanding ChatGPT

ChatGPT, an OpenAI development, is a specialized version of the GPT model designed to simulate human-like conversations. It excels in creating human-like text in dialogues, handling a variety of topics. It’s available for free at chat.openai.com, with a premium ChatGPT Plus option (also known as GPT-4), and can draft essays, generate art prompts, and program code. The premium version offers enhanced features such as visual and audio input and output handling, file uploads, code execution, data visualization with select Python libraries, and customizable GPT capabilities.

You can access ChatGPT simply by visiting chat.openai.com and creating an OpenAI account. It is also available as an app for both Android and iOS. More details can be found on the official website (https://openai.com/).

Figure 3.1: Offerings of OpenAI

How does ChatGPT work?

ChatGPT, paralleling Copilot’s code-oriented approach but in natural language processing, is adept at content generation, challenging traditional search engines. It excels in tasks such as essay writing and summarizing texts. The quality of ChatGPT’s responses heavily depends on the prompts it receives.

ChatGPT leverages extensive training data including books, websites, and a variety of textual sources for comprehensive language understanding.

It employs sophisticated machine learning algorithms, such as deep learning neural networks based on the Transformer architecture, to predict accurate and contextually relevant text responses.

ChatGPT’s contextual understanding is honed through advanced techniques, enabling it to interpret and respond to varying conversation threads intelligently. This approach mirrors the principles used in Copilot for code, adapted here for nuanced, human-like text interaction.

ChatGPT capabilities and limits

Capabilities of ChatGPT:

  • Content creation: Generates creative content including marketing material, blog posts, stories, and poems
  • Educational explanations: Offers detailed explanations on complex topics for educational purposes
  • Coding assistance: Assists developers with code optimization, error debugging, and algorithm design
  • Learning aid: Acts as a companion in online learning, offering real-time assistance and clarification of concepts
  • Conversational AI: Enhances user experience in virtual assistants and chatbots through natural language interactions

Limitations and concerns of ChatGPT:

  • Accuracy issues: ChatGPT may generate responses with factual inaccuracies or biases from training data, also known as hallucinations. These outputs often emerge from the AI model’s inherent biases, lack of real-world understanding, or training data limitations. In other words, the AI system “hallucinates” information that it has not been explicitly trained on, leading to unreliable or misleading responses. Hence, users should always verify and validate the responses and should not use them blindly.
  • Ethical implications: Raises concerns about the misuse of AI-generated content for fraudulent activities or harmful information gathering.
  • Employment impact: Fear of AI replacing human jobs in certain sectors.
  • Security risks: Potential use in phishing, creating malware, and cybercriminal activities.
  • Data privacy: Concerns about the use of vast internet data in training, impacting user privacy.
  • Message cap: At the time of writing the book, GPT-4 was capped to offer a maximum of 40 responses over 3 hours.
  • Limited Python libraries for code execution: The Code Interpreter and Advanced Data Analysis features of ChatGPT use limited sets of libraries, heavily featuring machine learning libraries but not such great support for other libraries, such as Keras or TensorFlow, required for deep learning.

Setup and installation

Setting up and installing ChatGPT involves a few steps:

  1. Create an OpenAI account: Visit the OpenAI website and sign up for an account.
  2. API access: Developers need to obtain API access by applying on the OpenAI platform.

For non-developers, using ChatGPT is as simple as visiting the ChatGPT website or installing the Android or iOS app and logging in with your OpenAI account. No installation is required for general use. For more detailed steps and information, please refer to OpenAI’s official documentation and website.

Getting started with ChatGPT

Once you’ve logged in to your OpenAI account on the ChatGPT side of the website, it’s time to get to know the AI tool’s window. Here’s a breakdown of what you will see:

  • New chat and hide sidebar buttons: On the left side of your screen, the New chat button can be used to start fresh conversations at any time. It creates a new discussion without context. There’s also an option to hide the sidebar.
  • Chat history: The left sidebar keeps your previous conversations accessible. You can edit chat titles, share your chat history, or delete it. Optionally, you can turn off chat history.
  • Account: Click your name at the bottom left to access your account information. This includes settings, log out, help, and FAQs. If you don’t have ChatGPT Plus, you’ll see an Upgrade button here.
  • Your prompts: Your questions or prompts appear in the middle of the chat window, accompanied by your account photo or initials.
  • ChatGPT’s responses: ChatGPT’s responses display the logo on the left. On the right, you’ll see options such as Copy, Thumbs Up, and Thumbs Down. Copy text to your clipboard for use elsewhere and provide feedback on response accuracy.
  • Regenerate response: Click Regenerate response if you encounter issues or unsatisfactory answers. It prompts ChatGPT to generate a new reply based on your latest prompt.
  • Text area: This is where you enter your prompts and questions.
  • ChatGPT version: Below the text input area, you’ll find fine print, including a disclaimer: “ChatGPT can make mistakes. Consider checking important information.” Note that the display of the ChatGPT model version has been discontinued.

The following screenshot illustrates how this looks.

In the top-left corner, you can see the GPTs you have access to if you have the premium version.

At the bottom are your previous conversations.

If you have the premium version, you can choose GPT-4 from the dropdown along with plugins.

Figure 3.2: Selecting different versions of ChatGPT

You can even set custom instructions at the profile level if you wish to apply your configuration to all new conversations.

Figure 3.3: ChatGPT custom instructions

Prompting

Let’s draft our first prompt with ChatGPT.

You just have to ask questions in your natural language and converse with it like you would with a human and it will start sharing its knowledge with you.

[Prompt]

Can you please explain the process of machine learning in bullet points to me?

[End of prompt]

You should see a response similar to the following screenshot. Note that the responses are never identical, and you will not get the exact same text each time.

Figure 3.4: ChatGPT prompt screen

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 $19.99/month. Cancel anytime
Banner background image