Beschreibung
Generative AI is transforming software development. Stay on the cutting edge with this guide to AI pair programming! Learn how to make the most of modern tools like ChatGPT and GitHub Copilot to improve your coding. Automate refactoring, debugging, and other tedious tasks, and use techniques such as prompt engineering and retrieval-augmented generation to get the code you need. Follow practical examples that show how you can program faster, more efficiently, and with fewer errors with the help of AI. In this book, youll learn about:a. Hype versus Reality Learn from expert developers to understand the possibilities (and pitfalls) of AI tools. With the help of practical code examples, see how to use AI helpers correctly to their full potential. b. Assistants for All Tasks This guide gives you an up-to-date overview of all aspects of AI-assisted coding: GitHub Copilot autocompletions, project bootstrapping with OpenHands, debugging and refactoring, application development, and more. c. In the Cloud or Local? Use OpenAIs API to integrate AI models directly into your own scripts and automationsor use local large language models (LLMs) to work independently of cloud services. Highlights include: 1) Structured programming with AI2) Debugging 3) Unit testing4) Refactoring5) Automatic document creation6) Database development and design7) Scripting and administration8) Local large language models (LLMs)9) Retrieval-augmented generation (RAG)10) ChatGPT and GitHub Copilot11) OpenHands12) OpenAI API
Produktsicherheitsverordnung
Hersteller:
Rheinwerk Verlag GmbH
service@rheinwerk-verlag.de
Rheinwerkallee 4
DE 53227 Bonn
www.rheinwerk-verlag.de
Autorenportrait
Michael Kofler is a programmer and one of the most successful and versatile computing authors in the German-speaking world. His current topics include AI, Linux, Docker, Git, hacking and security, Raspberry Pi, and the programming languages Swift, Java, Python, and Kotlin. Michael also teaches at the Joanneum University of Applied Sciences in Kapfenberg, Austria.
Inhalt
... Local Execution of Language Models ... 17
... Coding with AI Support for Advanced Users ... 18
... AI Makes Mistakes and Hallucinates ... 19
... The Three Stages of Using AI ... 19
... There’s No Getting around AI Tools ... 20
1.1 ... Coding via Chat ... 25
1.2 ... The Art of Prompting ... 34
1.3 ... Code Wizards ... 41
1.4 ... Chat or Wizard? ... 52
1.5 ... Basic Principles of Large Language Models ... 53
2.1 ... Structuring Code into Functions ... 68
2.2 ... Example: IBAN Validation ... 76
2.3 ... Object-Oriented Programming ... 83
2.4 ... Example: Quiz ... 91
2.5 ... Example: Solving Sudoku ... 97
3.1 ... Web Applications ... 108
3.2 ... App Development ... 116
3.3 ... Developing on Raspberry Pi ... 119
3.4 ... Visual Studio and Visual Studio Code ... 122
3.5 ... Conclusion ... 125
4.1 ... Introduction to Refactoring ... 127
4.2 ... Refactoring Using AI Tools ... 128
4.3 ... Best Practices ... 141
4.4 ... Conclusion ... 142
5.1 ... Generating Test Data ... 146
5.2 ... AI-Supported Test Automation ... 149
5.3 ... Test-Driven Development with AI ... 155
5.4 ... Using Dependencies ... 161
5.5 ... Optimizing Tests ... 167
5.6 ... End-to-End Tests ... 174
5.7 ... Conclusion ... 178
6.1 ... Challenges with Documentation ... 180
6.2 ... Inline Documentation ... 181
6.3 ... Function and Class Documentation ... 184
6.4 ... API Documentation ... 187
6.5 ... Outdated Documentation ... 191
6.6 ... Conclusion ... 194
7.1 ... Database Design ... 195
7.2 ... SQL Commands ... 205
7.3 ... Administration ... 213
7.4 ... Client Programming ... 219
8.1 ... Scripting ... 221
8.2 ... Example: Converting a Python Script to PHP Code ... 228
8.3 ... Regular Expressions ... 230
8.4 ... System Administration ... 234
8.5 ... Example: “wget” Script Plus “tmpfs” Configuration ... 240
8.6 ... Calling GitHub Copilot and ChatGPT in the Terminal ... 245
9.1 ... Spoiled for Choice of Large Language Model ... 254
9.2 ... GPT4All ... 259
9.3 ... Ollama ... 262
9.4 ... Open WebUI for Ollama ... 267
9.5 ... Continue ... 275
9.6 ... Ollama API ... 277
9.7 ... Tabby ... 280
9.8 ... Conclusion ... 282
10.1 ... OpenAI API ... 286
10.2 ... Ollama API ... 297
10.3 ... Groq API ... 299
10.4 ... Example: Automated Commenting of Code ... 301
10.5 ... Example: From Python 2 to Python 3 ... 308
11.1 ... OpenHands ... 314
11.2 ... Using OpenHands ... 320
11.3 ... Aider ... 323
11.4 ... Using Aider ... 328
12.1 ... RAG Quick Start ... 338
12.2 ... The Viel-Falter (Many Butterflies) Project ... 341
12.3 ... Loading Documents ... 343
12.4 ... Creating an Index ... 345
12.5 ... Vector Store Databases ... 348
12.6 ... RAG Queries ... 351
12.7 ... Text-to-SQL ... 355
13.1 ... Issues and Limitations of Using AI Tools ... 367
13.2 ... Exemplary AI Failure ... 370
13.3 ... Ethical Issues ... 381
13.4 ... Conclusions and Outlook ... 384