AI-Assisted Programming
Tom Taulli
AI-assisted programming tools like Copilot ... don't really "get" programming languages like compilers do. ... Instead, they use AI to guess and suggest bits of code based on tons of code that's already out there. Since the tools are playing the odds, the suggestions can vary a lot. ... Sometimes, AI tools miss something simple like a bracket, which a human coder or compiler would spot in a heartbeat. That is because the LLMs are based on predicting patterns, not a compiler engine. If something's not common in the training, they might not catch it.
Prompt-engineering is a subfield of maching learning and natural language processing, which is the study of enabling computers to understand and interpret human language. The main goal is to figure out how to talk to large language models.
A prompt for an LLM has four main components (you don't need all four components for every prompt):
- Context
- Example: You are an experienced software engineer specializing in debugging Python applications.
- Instructions for the LLM
- Summarization – Example: Summarize the main points of the following documentation.
- Text classification – Example: Could you summarize the overall sentiment of the following feedback?
- Recommendation – Example: Could you recommend any optimizations for the following code to make it faster and more readable?
- Translation – Example: Translate the following UI text into French. Save, Exit, File, Edit, Help.
- Input of content
- When crafting prompts, it's helpful to use special symbols like ### and """
- Example: Extract the key implementation steps for the API from the text below:
Documentation: """
[API documentation text here]
"""" - Format
- Example: Create a Python function that takes a list of user objects (each object containing a user's ID and name) and returns a JSON object that maps user IDs to names. Format the output as JSON.
Get this book on Amazon.