Refact.ai, an AI coding assistant, launches RAG! Now we offer you codebase awareness and repository-level context to deliver more customized and accurate AI suggestions, using your entire coding environment as a source of context.
When you edit code in an IDE, the code completion model typically only sees your current file. If needed definitions of functions or classes are in another file, the model won’t consider them as it can’t view the full project context. As a result, you might receive wrong and unhelpful AI suggestions.
So, how can we supply the model with the necessary information, so it can assist you better?
That’s where the Retrieval Augmented Generation (RAG) comes in. It helps the AI understand your entire programming environment, not just a single file. This way, a model can use information from different files to make coding suggestions relevant for users or enterprise customers.
RAG was first introduced in 2020 as a solution to the limitations of pre-trained language models. In this study, combining pre-set models and information from Wikipedia as a context source, RAG was able to generate more detailed, varied, and accurate responses.
The concept behind it is simple but effective: it connects large language models to external data, allowing LLMs to generate relevant output
RAG uses the entire repository to provide AI coding suggestions, relevant to the entire codebase of software companies and individual users.
Imagine you have a library:
If you only have my_file.py supplied to your model, it won’t know how to complete “say_hello” or that it needs a parameter for that function
This issue becomes worse as your project gets bigger. RAG solves this problem by fetching the necessary information from your codebase to help the model be more accurate.
Companies usually have huge codebases. Manually navigating through them to find the correct coding reference is tough and leads to long searches and mistakes. RAG makes this easy: it scans an entire company’s codebase and provides developers with accurate coding suggestions, using the code repository and project documentation as context for the answer. Whether it’s multiple, large-scale libraries or big projects with many teams, RAG finds the needed information for correct AI code completion. Context-awareness helps your programmers save time and keep the project consistent, overall making coding faster.
Make your software company benefit from RAG! Get your team Refact.ai Enterprise — 3 months free. Fill the form for details, or book a call with our team.
In Refact.ai, RAG supports both code generation and chat LLMs. This means RAG can assist you in finishing your code with accurate AI suggestions, as well as answering programming questions in our in-IDE chat! To achieve this, RAG analyzes all your project data — all the source files, including documentation.
Here’s how code generation works using RAG in the Refact.ai plugin:
This results in a measurable increase in completion quality: a random line of code has a higher probability of being exactly reproduced (from about 50% to 60% depending on the project). Accurate AI suggestions help developers finish coding tasks faster, making them more productive and happy about their work!
We use a small executable file that we ship along with the IDE plugin. It has the AST (Abstract Syntax Tree) parser and Vector Database inside, it’s self-contained, and doesn’t require you to install any additional software.
The reason why we were able to do it is Rust, an efficiently compiled language with safety guarantees.
The RAG pipeline at Refact.ai was created with some key requirements:
We will post a technical blog in the coming days that will go through all of the details.
RAG is a must-have for developers’ productivity. It gets the context of your coding tasks and searches the entire project in real time to provide you with the right answers. With RAG in Refact.ai, programmers save time and effort: it provides relevant code suggestions exactly when needed, boosting coding efficiency and minimizing errors.
More relevant AI suggestions with RAG are included in Refact.ai Pro, Refact.ai Teams, and Refact.ai Enterprise plans.
How to try RAG in Refact.ai?
For the new users: install Refact.ai in your favorite code editor (VS Code, JetBrains, Visual Studio Code, or Sublime Text) and choose the Plan you want on the Pricing page.