Code Generator and IA Assistant for Unpopular Frameworks
Cheap but precise code generator and assistant for proprietary frameworks
If you are a developer using hardly known frameworks, you must be struggling to find a code generator which really ease your daily work. The general-purpose statistical LLMs only work well, if they get enough training data with code and that code can only include the most popular tools and frameworks. All of us working on the unpopular side, are left in the dark.
Now I am holding a lamp at my work and it is called [https://aider.chat/|Aider]. After trying Github’s copilot , OpenIA ChatGPT and Jetbrain’s IA assistant , Aider using the Anthropic’s Claude 3.5 Sonnet is by far a more precise, project-aware and less error-prone IA code generator and assistant.
My daily tools and framework
Like you, my project use closed-sourced using commercial frameworks and tools.
Since 2010 I have been working with SAP proprietary products, SAP Commerce Cloud© and SAP Cloud Application Programming Model© (CAP), which run on SAP BTP© cloud. Although these products use Java and Typescript as the main programming languages, and they are based on the Spring Framework and NodeJS, they have lots of nuances that every developer has to learn to be productive in this environment.
My main tool is the terminal. With it I start the local server, troubleshoot issues on the cloud foundry environments, resolve merge conflicts and prepare sample data using Unix commands. Intellij IDEA is my favorite IDE due to its stability and refactoring features. Even on large commercial projects with lots of generated files, it is faster and provides useful auto-complete phrases.
Where is Aider with Cloude at most useful?
- Troubleshooting issues when you have a hint of location of it: You add those files to the chat and Cloude can help you. If after two question, it still don’t provide you with a good answer, please search for the solution on StackOverflow. You will be faster looking there
- Creating Python scripts to manipulate CSV files containing sample data: Cloude don’t make mistakes when slicing and filtering CSV files. Sometimes I have to only do minor corrections to the split conditions on the generated Python script. But at the end I spare 30+ minutes
- Writing CURL or WGET requests to get additional information: When I have to prepare OAuth requests, call an API or extract information with the Cloud Foundry command line, Cloude is an excellent companion
- Creation of Spring MVC tests: This is an easy task for Cloude as long as you don’t have strict coding conventions
- Improvement of BASH scripts: When you have a failing script, or you want to make it more robust, just ask Cloude for help
- Creation a class or test based on an existing one
Where Aider won’t be useful?
For complex programming tasks where you only write the code once. On tickets which use feature of the proprietary framework which is unknown to the AI code generators. On any troubleshooting which requires a deep knowledge of the tools. In those cases, it is more useful to collect all the information which I have and talk with a workmate. While telling him/her about the problem, my brain usually find the solution or root cause of the issue.
If you only use your IDE while programming, Aider’s lack of integration with IDEs will make it less useful for your daily work.
How to install and use Aider with Cloude?
- To get a lower price per token and higher monthly limits, I access Anthropic’s Claude through OpenRouter AI , a unified interface for LLMs. As your first step, please create an account there and buy some credit
- Copy the API key of OpenRouter for the next step
- Now create a configuration file for the Aider chat on $HOME/.env with the following command:
cat > ~/.env << AIDERCONFIG
# LLM Selection
AIDER_MODEL=openrouter/anthropic/claude-3.5-sonnet:beta
WEAK_MODEL=openrouter/anthropic/claude-3-haiku
# We don't want Aider to commit files
AIDER_GITIGNORE=false
AIDER_AUTO_COMMITS=false
AIDER_DIRTY_COMMITS=false
AIDER_ATTRIBUTE_AUTHOR=false
AIDER_ATTRIBUTE_COMMITTER=false
AIDER_VIM=true
OPENROUTER_API_KEY=<YOUR OPEN ROUTER API KEY>
AIDERCONFIG
- Optional step: To allow Aider to calculate the cost of each inquiry, you can add information about your used models:
cat > ~/.aider.model.metadata.json << AIDERCONFIG
{
"openrouter/anthropic/claude-3.5-sonnet:beta": {
"max_tokens": 8192,
"max_input_tokens": 8192,
"max_output_tokens": 8192,
"input_cost_per_token": 0.00003,
"output_cost_per_token": 0.00015
},
"openrouter/anthropic/claude-3-5-haiku:beta": {
"max_tokens": 4096,
"max_input_tokens": 4096,
"max_output_tokens": 4096,
"input_cost_per_token": 0.0000025,
"output_cost_per_token": 0.0000125
},
"openrouter/anthropic/claude-3-haiku": {
"max_tokens": 4096,
"max_input_tokens": 4096,
"max_output_tokens": 4096,
"input_cost_per_token": 0.0000025,
"output_cost_per_token": 0.0000125
}
}
AIDERCONFIG
- Now you can install the Aider chat in Python virtual environment to avoid messing up with other Python projects:
mkdir $HOME/no_backup
python -m venv ~/no_backup/aidervenv
source ~/no_backup/aidervenv/bin/activate
python -m pip install aider-chat
- To easily start Aider everywhere, please add an alias to your bash shell:
echo 'alias aidstart="source ~/no_backup/aidervenv/bin/activate && aider"' >> .bashrc
- Now you can open a new terminal and type
aidstart
. This will start the AI code generator and assistant.
My bad experience with general AI assistants and code generators
On small hobby projects based on Spring Boot on Java or Flask on Python, they can generate the initial classes and test cases. And their troubleshooting capabilities are fairly good. But when I switch to my work projects, any usefulness disappears. All the generated tests contain mistakes, or they don’t follow the coding conventions. The advice tries to solve an issue using new libraries which cannot be added to the project. Finally the structure of the project cannot be understood by the AI code assistant, so changes in wrong files are proposed.
FAQ
Is Aider with Cloude more expensive than Github’s copilot, ChatGPT or JetBrains’ AI Assistant?
Depends on how often you use it. Because most of my work involves proprietary frameworks, I only use an AI assistant when the task is general. This means that the pay-as-you-use model of Aider is cheaper for me. At the end of each answer, Aider gives you an estimation of the answer’s and session’s cost. To keep the cost low, only add those files which are valuable for the question because the bigger the context, the most expensive is the question.
How can I give Aider more context about my project?
Just change to the directory where you have your source code, user the command /add
to add meaningful files like pom.xml to the chat and ask your question.
Aider is always eager to change the source code. How can I only ask a question?
Please start the question with /ask
if you want to ask a question and don’t want to generate code. Otherwise you can use /code
or no prefix, if you want Aider to change your files when it finds a solution or understood your question.
Do you spare time by using AI code generators as a developer?
Yes, if I am smart enough to choose a task which can be done by the LLM. If I blindly ask the AI assistant for code, the generated lines must be corrected and at the end of the day I am slower than working without the AI assistant
Did you try other models designed for code generation?
No. I was so happy with the results of Anthropic’s Claude 3.5 Sonnet that I stopped searching for other tools. If you find something better with working with proprietary frameworks, please drop me a line.