Chat with Repositories
GitLoop is a powerful tool designed for indexing and analyzing repositories. We have harnessed its capabilities to create one of the best bots available, capable of answering questions about any codebase within a repository. Our goal is to provide a smooth and seamless experience for our users.
Upon creating a GitLoop account, the first thing you'll notice is the assistant box. This feature allows users to ask questions about their codebase, such as:
- Finding specific code: "Find me the code that handles analytics and metrics."
- Generating documentation: "Create a README for the entire project."
- Generating unit tests: "Generate unit tests for the billing module" or "Generate unit tests for the billing webhook file."
- Optimizing code: "Optimize the data integrity code for better event loop performance."
And much more...
Real-World Example
Let's illustrate this with an example to show how this feature works.
In your assistant chatbox, select a repository. A popup will appear, prompting you to enter the link to your repository, whether it's an SSH GitHub link or an HTTPS link. Ensure you have the required permissions or that the repository is public to proceed.
After entering the link, you will see the repository marked with a red question mark, indicating that it is not yet indexed. Click on the play button to begin indexing the repository.
Indexing the repository
The indexing process in GitLoop AI involves reading chunks of your code and creating a vectorial representation of each file, allowing the AI to access and analyze it later. This intensive processing is generally well-handled by GitLoop. However, there are instances where some repositories contain heavy files or dependencies that are not essential for a comprehensive understanding of the codebase.
To address this, we have implemented a simple way to ignore unnecessary files. When you start the indexing process, you will be presented with a popup to exclude heavy files. If your repository is particularly large and you do not have a premium subscription, you can still benefit from lower-quality indexing by ignoring files or folders that you deem unnecessary, thereby conserving tokens.
Ask your question
Now that the indexing is finished, you can start asking your questions. For example, you might ask, "Explain the project."
As seen in the image, GitLoop provides a general explanation of how the project works. You can make follow-up queries and ask for more details about anything specific.
Advanced feature: Personalized Agent for Your Codebase
The beauty of GitLoop is that you can personalize the agent for your specific repository needs. By clicking on the config gear inside the chatbox, an agent popup containing all the settings will be shown.
Here's a detailed guide on how to set up and configure your AI assistant for optimal performance:
- User Question Configuration:
- You can define the maximum number of tokens for user questions, allowing you to control the length and complexity of the questions users can ask. In this example, it is set to a maximum of 1000 tokens.
- Retrieve Code Snippets from Codebase with AI:
- Specify the number of code snippets the AI should retrieve from the codebase. Here, it is configured to retrieve 30 snippets.
- Enable or disable smart retrieval. Smart retrieval helps in fetching the most relevant code snippets based on the user question.
- Set the maximum context tokens, which defines the amount of context the AI can use to answer the question. This example shows a maximum context of 8000 tokens.
- Instructions for the AI:
- Provide clear and concise instructions for the AI to follow. In this setup, the AI is instructed: "You will be provided context from the codebase as code snippets delimited by triple quotes, related to the user question, and your task is to answer the question about the codebase."
- Answer Configuration:
- Define the maximum number of tokens for the AI's answers. This example uses a maximum of 4000 tokens.
- Select the model to be used for generating answers. In this case, the GPT-4 model is chosen for its advanced capabilities.
By tailoring these settings, GitLoop ensures that the AI assistant is well-equipped to handle the specific needs of your repository, providing accurate and relevant responses based on the codebase context. This customization enhances the user experience, making interactions with the AI both efficient and effective.