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
Conferences
Free Learning
Arrow right icon
AI-Assisted Programming for Web and Machine Learning
AI-Assisted Programming for Web and Machine Learning

AI-Assisted Programming for Web and Machine Learning: Improve your development workflow with ChatGPT and GitHub Copilot

Arrow left icon
Profile Icon Christoffer Noring Profile Icon Ajit Jaokar Profile Icon Ayşe Mutlu Profile Icon Marina Fernandez Profile Icon Anjali Jain +1 more Show less
Arrow right icon
€8.99 €28.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (9 Ratings)
eBook Aug 2024 602 pages 1st Edition
eBook
€8.99 €28.99
Paperback
€35.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Christoffer Noring Profile Icon Ajit Jaokar Profile Icon Ayşe Mutlu Profile Icon Marina Fernandez Profile Icon Anjali Jain +1 more Show less
Arrow right icon
€8.99 €28.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (9 Ratings)
eBook Aug 2024 602 pages 1st Edition
eBook
€8.99 €28.99
Paperback
€35.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €28.99
Paperback
€35.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

AI-Assisted Programming for Web and Machine Learning

Introduction

In the previous chapter, we gave some historical context to how AI has developed over the years, how we’ve gone from natural language processing (NLP) to large language models (LLMs), and how the latter serves as the underlying machine learning model in AI assistants. To use these AI assistants, you use natural language prompts as input. However, to ensure you “prompt” in an efficient way, so that you get what you want, it’s important to have a strategy, and that’s what this chapter aims to give you.

How to “prompt” efficiently is commonly known in the industry as a “prompt strategy” or “prompt engineering.” It’s not an engineering practice in the common sense of the word but rather an art form where practitioners of AI assistants have discovered patterns and practices that seem to work well. We, the authors of this book, are building upon those discovered practices and aim to describe...

Where you are

As a reader and a practitioner of data science and/or full-stack web development, you know your craft. Knowing your craft means you know the tools and techniques to solve problems. At this point, you’re looking at an AI assistant and realize it’s controlled by natural language, so-called prompts. What you may not realize is that there’s more to it than just writing a prompt and getting an answer. An AI assistant is trained on a large corpus of text, so it’s quite flexible on what it can generate text on and how to respond to prompts. Because of this flexibility, it’s important to understand how to write prompts that are effective and efficient.

Guidelines for how to prompt efficiently

Prompts are input to AI tools. Depending on what you’re trying to achieve, you need to adjust your prompts for the scenario you’re solving for. Therefore, how you “prompt” matters. For example, if your prompt is too vague, you won’t get what you need. Or, let’s say you’re trying to use a prompt to generate company slogans; you don’t want to use the same prompt for generating code for an app. Conversely, in a discipline like data science, it’s important you perform tasks in a certain order and your prompt should reflect what you want done and, if needed, the steps to do so.

What you need to succeed is an approach, a strategy, that you can use in general to be efficient with AI assistants. Additionally, such a strategy should be specific enough to present “best practices” for chosen problem domains. As mentioned earlier in this chapter, we’ve developed a prompt...

Prompt strategy for web development

Let’s apply the different guidelines presented in the former section, and through using these guidelines, we will step by step work ourselves toward a prompt strategy.

Break down the problem: “web system for inventory management”

Let’s use a real example, “inventory management” within web development, to see if we can understand the general problem. To “manage” an inventory, you need to read and write data to it. Most likely, you will have different roles in this system/app, everything from administrators to normal users. You might also need to consider how this system fits in with other systems, should you, for example, integrate it with other systems, what parts it consists of in that case and how.

The domain seems pretty straightforward so let’s move on to understand what parts it consists of.

At a high level, we understand what the system should do. But to solve...

Prompt strategy for data science

Let’s do a similar thought experiment for data science as we did for web development. We’ll use the presented guidelines “problem breakdown” and “generate prompts,” and just like in the web development section, we’ll draw some general conclusions on the domain and present those as a prompt strategy for data science.

Problem breakdown: predict sales

Let’s say we’re building a machine-learning model to predict sales. At a high level, we understand what the system should do. To solve the problem though, we need to divide it into smaller parts, which in data science usually entails the following components:

  • Data: The data is the part of the system that stores information. The data can come from many places like databases, web endpoints, static files, and more.
  • Model: The model is responsible for learning from the data and producing a prediction that’s as accurate...

Validate the solution

The most important part of this strategy is verifying correctness and that the text and code created by the AI assistant are correct. There are two general approaches we can take to verify our outcome:

  • Verification via prompts: The first approach is to use prompts to verify the outcome. This means writing prompts that question the outcome of specific results. This can be a good strategy to employ at the beginning of your verification process. What you’re looking for are situations where the AI assistant isn’t consistent in its responses.
  • Classical verifications: The second approach is to use classical verification techniques. What those techniques are varies depending on the problem domain. At a high level, though, it boils down to testing code, comparing output, and relying on your own knowledge, and the knowledge of your peers, to verify the outcome.

The AI tool doesn’t really know what it’s doing. The...

Summary

Throughout this chapter, we’ve provided a strategy for solving problems with prompts and validating the solution.

You’ve seen how both web development and data science can be broken down into smaller parts that can be solved with prompts. We also identified some basic principles for writing prompts.

Finally, we looked at how to validate the solution using prompts and classical verification techniques.

It’s our hope that you will revisit this chapter when you’re looking at solving a problem within web development or data science and you’re looking for an approach.

There’s more to prompting than writing a prompt and getting a response. You will see throughout this book how we use these principles in various domains to solve problems. Try typing these prompts as you read, adapt to your own needs, and see what happens.

In the next chapter, we are going to learn more about the two AI assistants of our choice, GitHub...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Utilize prompts to enhance frontend and backend web development
  • Develop prompt strategies to build robust machine learning models
  • Use GitHub Copilot for data exploration, maintaining existing code bases, and augmenting ML models into web applications

Description

AI-Assisted Programming for Web and Machine Learning shows you how to build applications and machine learning models and automate repetitive tasks. Part 1 focuses on coding, from building a user interface to the backend. You’ll use prompts to create the appearance of an app using HTML, styling with CSS, adding behavior with JavaScript, and working with multiple viewports. Next, you’ll build a web API with Python and Flask and refactor the code to improve code readability. Part 1 ends with using GitHub Copilot to improve the maintainability and performance of existing code. Part 2 provides a prompting toolkit for data science from data checking (inspecting data and creating distribution graphs and correlation matrices) to building and optimizing a neural network. You’ll use different prompt strategies for data preprocessing, feature engineering, model selection, training, hyperparameter optimization, and model evaluation for various machine learning models and use cases. The book closes with chapters on advanced techniques on GitHub Copilot and software agents. There are tips on code generation, debugging, and troubleshooting code. You’ll see how simpler and AI-powered agents work and discover tool calling.

Who is this book for?

Experienced developers new to GitHub Copilot and ChatGPT can discover the best strategies to improve productivity and deliver projects quicker than traditional methods. This book is ideal for software engineers working on web or machine learning projects. It is also a useful resource for web developers, data scientists, and analysts who want to improve their efficiency with the help of prompting. This book does not teach web development or how different machine learning models work.

What you will learn

  • Speed up your coding and machine learning workflows with GitHub Copilot and ChatGPT
  • Use an AI-assisted approach across the development lifecycle 
  • Implement prompt engineering techniques in the data science lifecycle
  • Develop the frontend and backend of a web application with AI assistance 
  • Build machine learning models with GitHub Copilot and ChatGPT 
  • Refactor code and fix faults for better efficiency and readability 
  • Improve your codebase with rich documentation and enhanced workflows 

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Aug 30, 2024
Length: 602 pages
Edition : 1st
Language : English
ISBN-13 : 9781835083895
Vendor :
OpenAI
Category :
Languages :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Aug 30, 2024
Length: 602 pages
Edition : 1st
Language : English
ISBN-13 : 9781835083895
Vendor :
OpenAI
Category :
Languages :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 107.97
Generative AI Application Integration Patterns
€37.99
Python Feature Engineering Cookbook
€33.99
AI-Assisted Programming for Web and Machine Learning
€35.99
Total 107.97 Stars icon
Banner background image

Table of Contents

24 Chapters
It’s a New World, One with AI Assistants, and You’re Invited Chevron down icon Chevron up icon
Prompt Strategy Chevron down icon Chevron up icon
Tools of the Trade: Introducing Our AI Assistants Chevron down icon Chevron up icon
Build the Appearance of Our App with HTML and Copilot Chevron down icon Chevron up icon
Style the App with CSS and Copilot Chevron down icon Chevron up icon
Add Behavior with JavaScript Chevron down icon Chevron up icon
Support Multiple Viewports Using Responsive Web Layouts Chevron down icon Chevron up icon
Build a Backend with Web APIs Chevron down icon Chevron up icon
Augment Web Apps with AI Services Chevron down icon Chevron up icon
Maintaining Existing Codebases Chevron down icon Chevron up icon
Data Exploration with ChatGPT Chevron down icon Chevron up icon
Building a Classification Model with ChatGPT Chevron down icon Chevron up icon
Building a Regression Model for Customer Spend with ChatGPT Chevron down icon Chevron up icon
Building an MLP Model for Fashion-MNIST with ChatGPT Chevron down icon Chevron up icon
Building a CNN Model for CIFAR-10 with ChatGPT Chevron down icon Chevron up icon
Unsupervised Learning: Clustering and PCA Chevron down icon Chevron up icon
Machine Learning with Copilot Chevron down icon Chevron up icon
Regression with Copilot Chat Chevron down icon Chevron up icon
Regression with Copilot Suggestions Chevron down icon Chevron up icon
Increasing Efficiency with GitHub Copilot Chevron down icon Chevron up icon
Agents in Software Development Chevron down icon Chevron up icon
Conclusion Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(9 Ratings)
5 star 88.9%
4 star 11.1%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




N/A Oct 14, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book reference for developers who want understanding utility of developing software with generative artificial intelligence.
Feefo Verified review Feefo
Charlie Wright Oct 01, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A simple, easy to understand prompt engineering flow as outlined early in the book guides the way to more in depth ideas. The writing is clear and logical in the way it progresses from one point the the next taking you along step by step in understanding the material.
Amazon Verified review Amazon
Thomas M. Sep 22, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As an avid developer always looking to stay ahead of the curve, I was thrilled to dive into this book covering all things AI-assisted programming. I was skeptical at first in terms of what an AI-assisted workflow might look like, but I found this to be a comprehensive guide for anyone seeking to harness the power of AI in their development workflow -- truly a game-changer for how I'll approach future projects.The authors have masterfully crafted a resource that bridges the gap between traditional programming and the nascent world of AI-assisted development. What sets this book apart IMO is its practical, hands-on approach to integrating tools like ChatGPT and GitHub Copilot into real-world projects. The step-by-step walkthroughs for building an e-commerce application are particularly illuminating, demonstrating how AI can streamline every stage of development from frontend design to backend implementation.I was impressed by the book's thorough coverage of prompt engineering techniques. The authors provide invaluable strategies for effectively communicating with AI assistants, turning what could be a daunting task into, really, an art form. This skill alone is worth the price of admission, so to speak, as it dramatically enhances productivity and opens up new possibilities in code generation and problem-solving.I found the ML sections to be equally robust, offering detailed guidance on tasks like data exploration, model building, and hyperparameter tuning, bridging classical and modern ML techniques seamlessly. The authors' approach of using both free and paid versions of ChatGPT showcases the tools' versatility and accessibility for developers at all levels. The book doesn't just teach you how to use these powerful tools, but also how to validate and refine AI-generated solutions. This balanced perspective ensures that readers develop a critical eye alongside their newfound AI skills, which is what more companies look for in applied ML.For those concerned about the learning curve, fear not. The authors have structured the content to cater to both AI newcomers and seasoned professionals. The historical context and explanations of underlying concepts provide a solid foundation, while the advanced chapters offer plenty of depth for experienced developers. I was a bit hesitant as to whether this would be suitable for me since my domain is more data science, but I found this to be a perfect read for both DS and CS alike.In a world where AI is reshaping the software development landscape, I'm convinced that this book is a ticket to riding the wave of innovation with clarity and success. If you're looking to supercharge your development process, stay competitive in a rapidly evolving tech landscape, or simply curious about the future of programming, this book is an absolute must-read IMO. It's not just a manual; it's a roadmap to becoming a more efficient, innovative, and AI-savvy developer.
Amazon Verified review Amazon
Banachan Oct 15, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book gives a great progression of the topics in regard to LLMs and use cases. It starts with the basic principles and premises and goes into more details chapter by chapter. So if you want a broad landscape perspective of use LLMs especially on how it is applied in chats, assistants, and used to help generate regression, classification unsupervised, and even deep learning models, etc. this is a good book to get and utilize for your purposes. It gives a good grounding on the world of LLMs and how to apply it by walking you through its practical applications and approaches.While not as deep technically as I would have hoped, it gives a good grounding on what to expect for such a new field in AI. Concepts on how apply LLMs in prompting, front and back end web app dev using assistants, data analysis are covered in enough detail. If you're already familiar with traditional classification and regressions modeling, it also covers how do it with LLMs. It blends both the traditional and newer methods to give you a sense on how to leverage what you already know with LLM based approaches. The code generation assistants make for a good exercise to accelerate your machine learning coding efforts.In all these of course, you need to have a good understanding of machine learning to begin with, as depending 100% on AI is not a panacea for good machine learning modeling expertise to apply in the real world. A small bonus content is that the book also covers Agentic processes in software development. Since this area is so new (as of this writing), a good basic introduction on the concepts were discussed.Overall, a good read providing a good virtual roadmap on how to do traditional machine learning using more cutting -edge tools and assistants. Highly recommended book and must read for those getting into the LLM field.
Amazon Verified review Amazon
Brian Hedgeman Sep 16, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is an invaluable resource for both seasoned developers and those just beginning to explore the world of AI-driven programming. Authored by a team of experts, this book provides a comprehensive guide to leveraging AI tools like ChatGPT and GitHub Copilot to enhance your development workflow.One of the standout features of this book is its clear and structured approach to integrating AI into various stages of web development and machine learning projects. The authors skillfully break down complex concepts into manageable pieces, making it accessible to readers with different levels of expertise. The detailed explanations of prompt strategies and the step-by-step guidance on using AI tools for specific tasks are particularly useful.The book is not just a technical manual; it also offers insights into the evolving landscape of programming languages and the role AI is playing in this transformation. The historical context provided in the early chapters sets the stage for understanding the significance of AI in today's development environment.What I appreciate most about this book is its practical focus. Each chapter is filled with real-world examples, assignments, and challenges that encourage hands-on learning. The authors emphasize the importance of validating AI-generated solutions, ensuring that readers not only learn how to use AI tools but also how to do so responsibly.Overall, this book is a must-read for anyone looking to stay ahead in the rapidly changing world of software development. Whether you're interested in improving your productivity, exploring new AI-driven possibilities, or simply curious about the future of programming, this book has something valuable to offer. Highly recommended!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.