GILT (Generation-based Information-support with LLM Technology) is a prototype in-IDE LLM information support tool.
Its original version only supports OpenAI and requires an OpenAI API key, and is available in the VS Code Marketplace.
This fork now uses Ollama as its default engine, enabling support for local LLMs, with llama3.1:latest
for chat and text completions, and codestral:22b-v0.1-q6_K
for code completions.
npm install
tsc
vsce package
code --install-extension ./gilt-1.0.0-beta.vsix
To use GILT, you will need your own OpenAI API key, or local LLMs through Ollama.
To trigger the tool, simply highlight a line of code and click on "AI Explanation" in the bottom blue bar or use the alt/option
+ a
shortcut. On the left tab, you will find a summary description of the highlighted code. You can also trigger the tool by selecting the entire source code to see an overview of the entire source code.
You can click any of the three buttons (API, Concept, Usage) below the summary description to further engage the tool as many times as needed:
- The
API
button provides detailed explanations about the API calls used in the code. - The
Concept
button introduces domain-specific concepts that are relevant to understanding the highlighted code. - The
Usage
button offers code examples involving the API calls used in the highlighted code.
You have the option to ask the AI model questions directly using the input box. For example, you can ask questions like "Where do I perform addition?" and click the Ask
button or press Enter
. You can also inquire about specific parts of the code by highlighting them and asking questions.
When you want to keep the information generated by the AI, simply use the Embed
button. The AI-generated response will be added to the line before the highlighted code or before the cursor.
If you don't select any part of your code, you can ask follow-up questions to further interact with the LLM. If you don't need to ask a follow-up question, you can simply click the Clear All
button or trigger the tool with new code context.
You can collapse or expand previous information by clicking on the arrow icon next to the Embed
button.
To update your OpenAI API Key:
- Open the command palette with
Ctrl/Cmd + Shift + p
. - Type
Update OpenAI API Key
. - Enter your new API Key into the prompt.
- Reload the window.
To remove your OpenAI API Key:
- Open the command palette with
Ctrl/Cmd + Shift + p
. - Type
Update OpenAI API Key
. - Enter your API Key into the prompt.
- Reload the window.
You can configure the LLM settings at Settings
> Extensions
> GILT
(Ctrl/Cmd + ,
).
Configurations that may be useful to adjust include:
- To communicate with Ollama on a different port or host, set
ollamaUrl
tohttp://<ip>:<port>
, replacing and with the appropriate values. - To use OpenAI as the LLM engine, set
llmProvider
toopenai
. - To use the GPT-4 model, set
Chat Model
togpt-4
. - The temperature controls how much randomness is in the output. The default value for GILT is
0.2
. Use0
to make it produce the same output every time you ask the same question or increase it for more creativity. - To allow GILT to incorporate longer context and prompts, increase
Max Tokens
.
If you encounter error messages from GPT API requests, please refer to this Error codes for detailed information.
To reference GILT in your research, please cite our upcoming ICSE'24 paper.
@inproceedings{nam2024gilt,
title={Using an LLM to Help With Code Understanding},
author={Daye Nam and Andrew Macvean and Vincent Hellendoorn and Bogdan Vasilescu and Brad Myers},
booktitle={Proceedings of the 46th International Conference on Software Engineering (ICSE 2024)},
year={2024}
}