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
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
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (9 Ratings)
Paperback Aug 2024 602 pages 1st Edition
eBook
$9.99 $38.99
Paperback
$47.99
Subscription
Free Trial
Renews at $19.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
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (9 Ratings)
Paperback Aug 2024 602 pages 1st Edition
eBook
$9.99 $38.99
Paperback
$47.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$9.99 $38.99
Paperback
$47.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781835086056
Vendor :
OpenAI
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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
$279.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 $ 142.97
AI-Assisted Programming for Web and Machine Learning
$47.99
Python Feature Engineering Cookbook
$44.99
Generative AI Application Integration Patterns
$49.99
Total $ 142.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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.