Context
Context refers to the surrounding information that Refact.ai uses to provide a better quality of generated code. This can include:
- Code Syntax: By analyzing the current state of the code, Refact.ai can provide syntactically correct code completions.
- Developer’s Intent: Interpreting comments, variable names, and function signatures, Refact.ai can provide code suggestions that are more relevant to the developer’s intent.
- Repo-level awareness: By analyzing the repository’s codebase, Refact.ai can provide code suggestions that are more relevant to the existing codebase.
RAG
Refact.ai uses RAG (Retrieval-Augmented Generation) to fill the context with the information that is needed to provide a better quality of generated code.
Enabling RAG
In order to enable RAG, you need to follow the instructions depending on the version of the Refact.ai you are using.
Cloud Version
- In the settings of the plugin (can be accessed by pressing the cogwheel icon in the sidebar), under the
Refactai: Code Completion Model
section, specify thestarcoder2/3b
model. - To enable RAG for code completion, you need to enable the
Enable syntax parsing
checkbox under theRefactai: Ast
section. - To enable RAG for the AI chat, you need to enable the
Enable embedded vecdb for search
checkbox under theRefactai: Vecdb
section. Read more in the AI Chat Documentation about available features.
Refact Enterprise
- In the Web UI of your Refact.ai instance, navigate to the
Model Hosting
page. press theAdd Model
button to switch the model, locate and select one of thestarcoder2/
models.
- To enable RAG for code completion, you need to enable the
Enable syntax parsing
checkbox under theRefactai: Ast
section. - To enable RAG for the AI chat, you need to enable the
Enable embedded vecdb for search
checkbox under theRefactai: Vecdb
section. Read more in the AI Chat Documentation about available features. - If Vecdb checkbox is enabled in your VS Code settings, you need to select the
thenlper/gte-base
model in your Refact.ai instance. In the Web UI of your Refact.ai instance, navigate to theModel Hosting
page. Press theAdd Model
button, locate and select thethenlper/gte-base
model.