GitHub Copilot is Your AI Pair Programmer - accentient/github-copilot-devs GitHub Wiki
When someone first experiences the capabilities of GitHub Copilot, they often begin to imagine its potential beyond being just an AI pair programmer. They might envision it functioning as an entire programming team, capable of independently handling complex tasks and reporting back when completed. However, this isn't how Copilot operates.
Copilot is Not an Independent Programmer
GitHub Copilot is fundamentally an AI pair programmer. In traditional pair programming, two developers collaborate closely on the same task, rather than one delegating independent assignments to the other. Similarly, Copilot is designed to work with you, not for you. It cannot function as an autonomous team of programmers tackling projects independently. Instead, it serves as a tool to help you write code more efficiently and effectively.
Copilot Understands Immediate Context Only
Copilot operates within the immediate context provided by the code you are currently working on. It does not have a comprehensive understanding of the broader project architecture, long-term goals, or overarching requirements. Its functionality is limited to generating suggestions based on the immediate environment it can see.
While GitHub is actively exploring ways to enhance Copilot's contextual understanding through initiatives like GitHub Copilot Enterprise and custom model training, the standard version of Copilot, as used in this course, remains focused on immediate context.
Copilot Tokens
Generative AI systems, including Copilot, rely on tokens to generate code. Tokens represent the smallest units of code or text that the system can process. The more tokens provided, the more context Copilot has to generate relevant suggestions.
However, Copilot enforces limits on the number of tokens it can handle per request. These limits are not publicly disclosed and cannot be configured by users. They are in place to ensure responsible and ethical usage of the tool.
Many token-related limitations arise when Copilot is used in ways it was not designed for, such as expecting it to function as an independent programmer or handle excessively large tasks. Copilot is optimized to work collaboratively, assisting you in real-time code generation.
Tokens and Context
The number of tokens used directly corresponds to the context provided. If too much context is given, Copilot may struggle to generate meaningful results. Conversely, if too little context is provided, its suggestions may lack relevance.
Context is primarily determined by:
- The file and code currently being edited
- Other open files in the editor
- Conversations and references in Copilot Chat
To control context effectively, users should:
- Limit the number of open files
- Start fresh chat sessions for new tasks
- Be deliberate about which files are referenced in conversations
Be Specific About the Problem, Not the Solution
When interacting with Copilot, itโs important to focus on clearly defining the problem rather than prescribing a specific solution. Copilot excels at generating code to address problems but may struggle or produce errors when tasked with rigid or overly prescriptive instructions.
By articulating the problem well, you allow Copilot to generate solutions that align with your goals. Providing overly specific instructions can lead to errors, misinterpretations, or hallucinated outputs.