GAI Choy stands for Generative AI empowered, Code Helper On Your side. Yet another Copilot for coding, with built-in integration capability with Azure OpenAI models or, local LLM such as CodeShell.
Gai Choy, also known as Chinese mustard greens, is a type of leafy vegetable having a distinct, pungent flavor that is often described as spicy, slightly bitter, or peppery. Its strong flavor makes it a popular choice for adding depth and complexity to a variety of dishes. Despite its toughness, it becomes tender and more palatable when cooked, making it a versatile ingredient in the kitchen.
This project is forked from codeshell-vscode, with additional support for Azure OpenAI (AOAI) service integration and a couple of other enhancements. See Changelog or NOTICE for more details.
The GAI Choy
project is an open-source plugin developed based on the CodeShell LLM and Azure OpenAI service that supports Visual Studio Code. It serves as an intelligent coding assistant, offering support for various programming languages such as Python, Java, C/C++, JavaScript, Go, and more. This plugin provides features like code completion, code interpretation, code optimization, comment generation, and conversational Q&A to help developers enhance their coding efficiency in an intelligent manner.
Here's an exhuastive list of extensions I tried:
- openai-vscode
- No code-completion feature
- Does not seem to support clustered AOAI setup behind Azure Application Gateway
- Not open sourced
- Code GPT
Search "GAI Choy" in your Extensions tab in VSCode and install the plugin from there. VS Code Extension - Gai Choy
- Download the latest .vsix file from the Releases
- Navigate to Extensions tab in your VSCode
- Click the "..." button to the top-right
- Click "Install from VSIX..." and choose the downloaded .vsix file to install the extension.
- node version v18 and above
- Visual Studio Code version 1.68.1 and above
- Optional: The CodeShell service is running (not required for AOAI integration)
If you want to run the package from source code, you need to execute the following command:
git clone https://github.com/carusyte/GAI-Choy.git
cd GAI-Choy
npm install
npm exec vsce package
and it will create a visx package file like: gai-choy-${VERSION_NAME}.vsix
。
The AOAI service setup varies depending on how your cloud infrastructure is designed and implemented. Here's how-to article to get you started. For more production-grade setup you may consult cloud architect, engineer or SRE.
Note that this step is not required for AOAI integration. Please refer to source repo's README.md for details.
- Set the address for the CodeShell / AOAI service
- Configure whether to enable automatic code completion suggestions
- Set the time delay for triggering automatic code completion suggestions
- Specify the maximum number of tokens for code completion
- Specify the maximum number of tokens for Q&A
- Configure the model runtime environment
Note: Different model runtime environments can be configured within the plugin. For the CodeShell-7B-Chat-int4 model, you can choose the CPU with llama.cpp"
option in the Code Shell: Run Env For LLMs
menu. However, for the CodeShell-7B and CodeShell-7B-Chat models, you should select the GPU with TGI toolkit
option.
To use Azure OpenAI service as the LLM model, there're additional parameters that need to be configured:
- Chat model deployed in Azure
- Completion model deployed in Azure
- API Key
- API version
- Automatic Code Suggestions
- Keyboard Shortcut for Code Suggestions
During the coding process, code completion suggestions can automatically trigger when you pause input (configurable with the Auto Completion Delay
option, set to 1-3 seconds). Alternatively, you can manually trigger code completion suggestions using the shortcut key Alt+\
(for Windows) or Option+\
(for Mac).
When the plugin provides code suggestions, the suggested content appears in gray at the editor's cursor position. You can press the Tab key to accept the suggestion or continue typing to ignore it.
- Explain/Optimize/Cleanse a Code Segment
- Generate Comments/Unit Tests for Code
- Check Code for Performance/Security Issues
In the VSCode sidebar, open the plugin's Q&A interface. Select a portion of code in the editor, right-click to access the CodeShell menu, and choose the corresponding function. The plugin will provide relevant responses in the Q&A interface.
- Support for Multi-turn Conversations
- Maintain Conversation History
- Engage in Multi-turn Dialogues Based on Previous Conversations
- Edit Questions and Rephrase Inquiries
- Request Fresh Responses for Any Question
- Interrupt During the Answering Process
Within the Q&A interface's code block, you can click the copy button to copy the code block or use the insert button to insert the code block's content at the editor's cursor location.
Apache 2.0