Smolex - Code Entity Retrieval "GPT Action" for ChatGPT
Motivation
In the world of programming and coding, providing the right context to AI tools like ChatGPT is a major challenge. This is especially true when trying to discuss or enhance code. Enter Smolex, a specialized tool designed to tackle this problem. Smolex leverages the power of GPT technology to efficiently retrieve code entities from a codebase, making the conversation with AI tools more meaningful and context-rich.
Prime Use Cases
Smolex shines in several key areas:
- Writing Tests: When you need to write new tests based on existing ones, Smolex helps you find the relevant code quickly.
- Updating Code: If you have a suggestion for improving or updating a code, Smolex can assist by referencing existing classes and methods.
- Code Enhancement: Got a piece of code and wonder if there's a way to make it better? Smolex helps explore possible improvements.
Showcase
The capabilities of Smolex can be illustrated through a visual demo. Here's a glimpse of what it can do:
How it Works
Smolex operates by parsing the codebase and creating an Abstract Syntax Tree (AST) for each file within it. These ASTs are then stored in a SQLite database, facilitating fast and efficient lookups. While Smolex currently supports only Python, there's potential to extend its functionality to other programming languages in the future.
Setup
To get started with Smolex, follow these simple steps:
-
Install Dependencies: Ensure you have all the necessary packages by running:
pip install -r requirements.txt
-
Run the Fast API Server: Use the following command to launch the server:
app/main.py --index-root /Users/alice/code/smolex/
-
Configuration:
- Set up a new GPT.
- Incorporate the openapi.yml into your actions.
- Launch the server and benefit from seamless code retrieval and interaction.
Smolex offers a powerful and efficient way to enhance code interactions, making it easier for developers to provide the right context and improvements when working with AI models like ChatGPT.