Skip to content

RAG (Retrieval Augmented Generation)

Organizations want AI tools that use RAG because it makes those tools aware of proprietary data without the effort and expense of custom model training. RAG also keeps models up to date.  When generating an answer without RAG, models can only draw upon data that existed when they were trained. With RAG, on the other hand, models can leverage a private database of newer information for more informed responses. source

Copilot leverages Retrieval-Augmented Generation (RAG) to provide highly relevant, contextualized responses during development, enhancing the traditional code-generation capabilities of AI. RAG is a method that augments the model’s training data by dynamically retrieving new and relevant information from external sources, allowing Copilot to stay updated without retraining. RAG is used by default Copilot to read the open file, neighboring tabs, and any additional contextual data within the development environment, such as indexed repositories and knowledge bases. This method allows developers to access the latest information, making Copilot more adaptable and responsive to the current codebase and project requirements.

Copilot Extensions play a critical role in RAG by enabling developers to create custom tools that can access specific knowledge sources. These extensions can be built for private or public use and shared through the GitHub Marketplace. By integrating with a growing ecosystem of partners, Copilot Extensions allow developers to seamlessly interact with cloud environments, preferred tools, and services directly from their IDE or GitHub.

Organization owners can enhance Copilot setup by creating centralized knowledge bases composed of Markdown documentation across repositories. Developers can then use this documentation within Copilot Chat to receive detailed responses that reflect the specific needs of their organization’s code and processes. This interaction is easily initiated through simple commands, such as typing @github #kb in Visual Studio Code, allowing Copilot to pull relevant documentation to answer questions with pinpoint accuracy.

Additionally, Copilot's effectiveness is amplified through the indexing of repositories for semantic code search. While indexing isn't required to answer questions related to knowledge bases, pull requests, or issues, it significantly enhances Copilot's ability to respond to natural language queries about the repository's code. By indexing a repository, Copilot becomes capable of understanding the structure, relationships, and context within the code, allowing it to answer highly specific technical questions. Together, these capabilities make GitHub Copilot, powered by RAG, an essential tool for modern software development, providing developers with a robust, context-aware AI assistant.