mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 06:44:59 +00:00
Merge branch 'main' into swe-bench
This commit is contained in:
commit
e758b01fb6
33 changed files with 997 additions and 177 deletions
73
README.md
73
README.md
|
@ -8,9 +8,8 @@ and [git commit the changes](https://aider.chat/docs/faq.html#how-does-aider-use
|
||||||
with sensible commit messages.
|
with sensible commit messages.
|
||||||
You can start a new project or work with an existing git repo.
|
You can start a new project or work with an existing git repo.
|
||||||
Aider is unique in that it lets you ask for changes to [pre-existing, larger codebases](https://aider.chat/docs/repomap.html).
|
Aider is unique in that it lets you ask for changes to [pre-existing, larger codebases](https://aider.chat/docs/repomap.html).
|
||||||
Aider works well with GPT 3.5, GPT-4o, GPT-4 Turbo with Vision,
|
Aider works well with GPT-4o, Claude 3 Opus, GPT-3.5
|
||||||
and Claude 3 Opus.
|
and supports [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
||||||
It also supports [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="assets/screencast.svg" alt="aider screencast">
|
<img src="assets/screencast.svg" alt="aider screencast">
|
||||||
|
@ -23,7 +22,6 @@ It also supports [connecting to almost any LLM](https://aider.chat/docs/llms.htm
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
- [Getting started](#getting-started)
|
- [Getting started](#getting-started)
|
||||||
- [Example chat transcripts](#example-chat-transcripts)
|
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
- [Usage](#usage)
|
- [Usage](#usage)
|
||||||
- [Tutorial videos](https://aider.chat/docs/install.html#tutorial-videos)
|
- [Tutorial videos](https://aider.chat/docs/install.html#tutorial-videos)
|
||||||
|
@ -33,6 +31,7 @@ It also supports [connecting to almost any LLM](https://aider.chat/docs/llms.htm
|
||||||
- [Connecting to LLMs](https://aider.chat/docs/llms.html)
|
- [Connecting to LLMs](https://aider.chat/docs/llms.html)
|
||||||
- [LLM Leaderboards](https://aider.chat/docs/leaderboards/)
|
- [LLM Leaderboards](https://aider.chat/docs/leaderboards/)
|
||||||
- [Voice-to-code](https://aider.chat/docs/voice.html)
|
- [Voice-to-code](https://aider.chat/docs/voice.html)
|
||||||
|
- [Example chat transcripts](https://aider.chat/examples/)
|
||||||
- [FAQ](https://aider.chat/docs/faq.html)
|
- [FAQ](https://aider.chat/docs/faq.html)
|
||||||
- [Discord](https://discord.gg/Tv2uQnR88V)
|
- [Discord](https://discord.gg/Tv2uQnR88V)
|
||||||
- [Blog](https://aider.chat/blog/)
|
- [Blog](https://aider.chat/blog/)
|
||||||
|
@ -57,63 +56,31 @@ $ export ANTHROPIC_API_KEY=your-key-goes-here
|
||||||
$ aider --opus
|
$ aider --opus
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example chat transcripts
|
|
||||||
|
|
||||||
Here are some example transcripts that show how you can chat with `aider` to write and edit code with GPT-4.
|
|
||||||
|
|
||||||
* [**Hello World Flask App**](https://aider.chat/examples/hello-world-flask.html): Start from scratch and have aider create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
|
|
||||||
|
|
||||||
* [**Javascript Game Modification**](https://aider.chat/examples/2048-game.html): Dive into an existing open-source repo, and get aider's help to understand it and make modifications.
|
|
||||||
|
|
||||||
* [**Complex Multi-file Change with Debugging**](https://aider.chat/examples/complex-change.html): Aider makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
|
|
||||||
|
|
||||||
* [**Create a Black Box Test Case**](https://aider.chat/examples/add-test.html): Aider creates a "black box" test case without access to the source of the method being tested, using only a
|
|
||||||
[high level map of the repository based on tree-sitter](https://aider.chat/docs/repomap.html).
|
|
||||||
|
|
||||||
You can find more chat transcripts on the [examples page](https://aider.chat/examples/).
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Chat with aider about your code by launching `aider` from the command line with set of source files to discuss and edit together. Aider lets the LLM see and edit the content of those files.
|
* Chat with aider about your code by running `aider <file1> <file2> ...` from the command line with set of source files to discuss and edit together. Aider lets the LLM see and edit the content of those files.
|
||||||
* Aider can write and edit code in most popular languages: python, javascript, typescript, php, html, css, etc.
|
* Aider can write and edit code in most popular languages: python, javascript, typescript, php, html, css, etc.
|
||||||
* Aider works well with GPT 3.5, GPT-4o, GPT-4 Turbo with Vision,
|
* Aider works well with GPT-4o, Claude 3 Opus, GPT-3.5 and supports [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
||||||
and Claude 3 Opus. It also supports [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
|
||||||
* Request new features, changes, improvements, or bug fixes to your code. Ask for new test cases, updated documentation or code refactors.
|
* Request new features, changes, improvements, or bug fixes to your code. Ask for new test cases, updated documentation or code refactors.
|
||||||
* Aider will apply the edits suggested by the LLM directly to your source files.
|
* Aider will apply the edits suggested by the LLM directly to your source files.
|
||||||
* Aider will [automatically commit each changeset to your local git repo](https://aider.chat/docs/faq.html#how-does-aider-use-git) with a descriptive commit message. These frequent, automatic commits provide a safety net. It's easy to undo changes or use standard git workflows to manage longer sequences of changes.
|
* Aider will [automatically commit each changeset to your local git repo](https://aider.chat/docs/faq.html#how-does-aider-use-git) with a descriptive commit message. These frequent, automatic commits provide a safety net. It's easy to undo changes or use standard git workflows to manage longer sequences of changes.
|
||||||
* You can use aider with multiple source files at once, so aider can make coordinated code changes across all of them in a single changeset/commit.
|
* You can use aider with multiple source files at once, so aider can make coordinated code changes across all of them in a single changeset/commit.
|
||||||
* Aider can [give the LLM a map of your entire git repo](https://aider.chat/docs/repomap.html), which helps it understand and modify large codebases.
|
* Aider can [give the LLM a map of your entire git repo](https://aider.chat/docs/repomap.html), which helps it understand and modify large codebases.
|
||||||
* You can also edit files by hand using your editor while chatting with aider. Aider will notice these out-of-band edits and keep up to date with the latest versions of your files. This lets you bounce back and forth between the aider chat and your editor, to collaboratively code with an LLM.
|
* You can also edit files by hand using your editor while chatting with aider. Aider will notice these out-of-band edits and keep up to date with the latest versions of your files. This lets you bounce back and forth between the aider chat and your editor, to collaboratively code with an LLM.
|
||||||
* If you are using gpt-4 through openai directly, you can add image files to your context which will automatically switch you to the gpt-4-vision-preview model
|
* You can add images files to your chat if you are working with a vision capable OpenAI model (GPT-4o, GPT-4 Turbo, etc).
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Run the `aider` tool by executing the following command:
|
Run `aider` with the source code files you want to edit.
|
||||||
|
These files will be "added to the chat session", so that the LLM can see their
|
||||||
|
contents and edit them according to your instructions.
|
||||||
|
|
||||||
```
|
```
|
||||||
aider <file1> <file2> ...
|
aider <file1> <file2> ...
|
||||||
```
|
```
|
||||||
|
|
||||||
If your pip install did not place the `aider` executable on your path, you can invoke aider like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
python -m aider.main <file1> <file2>
|
|
||||||
```
|
|
||||||
|
|
||||||
Replace `<file1>`, `<file2>`, etc., with the paths to the source code files you want to work on.
|
|
||||||
These files will be "added to the chat session", so that the LLM can see their contents and edit them according to your instructions.
|
|
||||||
|
|
||||||
You can also just launch `aider` anywhere in a git repo without naming
|
|
||||||
files on the command line. It will discover all the files in the
|
|
||||||
repo. You can then add and remove individual files in the chat
|
|
||||||
session with the `/add` and `/drop` chat commands described below.
|
|
||||||
If you or the LLM mention one of the repo's filenames in the conversation,
|
|
||||||
aider will ask if you'd like to add it to the chat.
|
|
||||||
|
|
||||||
Think about the change you want to make and which files will need
|
|
||||||
to be edited -- add those files to the chat.
|
|
||||||
Don't add *all* the files in your repo to the chat.
|
|
||||||
Be selective, and just add the files that the LLM will need to edit.
|
Be selective, and just add the files that the LLM will need to edit.
|
||||||
If you add a bunch of unrelated files, the LLM can get overwhelmed
|
If you add a bunch of unrelated files, the LLM can get overwhelmed
|
||||||
and confused (and it costs more tokens).
|
and confused (and it costs more tokens).
|
||||||
|
@ -121,16 +88,23 @@ Aider will automatically
|
||||||
share snippets from other, related files with the LLM so it can
|
share snippets from other, related files with the LLM so it can
|
||||||
[understand the rest of your code base](https://aider.chat/docs/repomap.html).
|
[understand the rest of your code base](https://aider.chat/docs/repomap.html).
|
||||||
|
|
||||||
Aider also has many
|
You can also just launch aider anywhere in a git repo without naming
|
||||||
additional command-line options, environment variables or configuration file
|
files on the command line. It will discover all the files in the
|
||||||
to set many options. See `aider --help` for details.
|
repo. You can then add and remove individual files in the chat
|
||||||
|
session with the `/add` and `/drop` chat commands described below.
|
||||||
|
If you or the LLM mention any of the repo's filenames in the conversation,
|
||||||
|
aider will ask if you'd like to add them to the chat.
|
||||||
|
|
||||||
|
Aider also has many other options which can be set with
|
||||||
|
command line switches, environment variables or via a configuration file.
|
||||||
|
See `aider --help` for details.
|
||||||
|
|
||||||
|
|
||||||
## In-chat commands
|
## In-chat commands
|
||||||
|
|
||||||
Aider supports commands from within the chat, which all start with `/`. Here are some of the most useful in-chat commands:
|
Aider supports commands from within the chat, which all start with `/`. Here are some of the most useful in-chat commands:
|
||||||
|
|
||||||
* `/add <file>`: Add matching files to the chat session.
|
* `/add <file>`: Add matching files to the chat session, including image files.
|
||||||
* `/drop <file>`: Remove matching files from the chat session.
|
* `/drop <file>`: Remove matching files from the chat session.
|
||||||
* `/undo`: Undo the last git commit if it was done by aider.
|
* `/undo`: Undo the last git commit if it was done by aider.
|
||||||
* `/diff`: Display the diff of the last aider commit.
|
* `/diff`: Display the diff of the last aider commit.
|
||||||
|
@ -144,7 +118,7 @@ See the [full command docs](https://aider.chat/docs/commands.html) for more info
|
||||||
## Tips
|
## Tips
|
||||||
|
|
||||||
* Think about which files need to be edited to make your change and add them to the chat.
|
* Think about which files need to be edited to make your change and add them to the chat.
|
||||||
Aider has some ability to help the LLM figure out which files to edit all by itself, but the most effective approach is to explicitly add the needed files to the chat yourself.
|
Aider can help the LLM figure out which files to edit all by itself, but the most efficient approach is to add the needed files to the chat yourself.
|
||||||
* Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk the LLM through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
|
* Large changes are best performed as a sequence of thoughtful bite sized steps, where you plan out the approach and overall design. Walk the LLM through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
|
||||||
* Use Control-C to safely interrupt the LLM if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to the LLM with more information or direction.
|
* Use Control-C to safely interrupt the LLM if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply to the LLM with more information or direction.
|
||||||
* Use the `/run` command to run tests, linters, etc and show the output to the LLM so it can fix any issues.
|
* Use the `/run` command to run tests, linters, etc and show the output to the LLM so it can fix any issues.
|
||||||
|
@ -152,8 +126,11 @@ Aider has some ability to help the LLM figure out which files to edit all by its
|
||||||
* If your code is throwing an error, share the error output with the LLM using `/run` or by pasting it into the chat. Let the LLM figure out and fix the bug.
|
* If your code is throwing an error, share the error output with the LLM using `/run` or by pasting it into the chat. Let the LLM figure out and fix the bug.
|
||||||
* LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues.
|
* LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about APIs and function arguments. You can paste doc snippets into the chat to resolve these issues.
|
||||||
* The LLM can only see the content of the files you specifically "add to the chat". Aider also sends a [map of your entire git repo](https://aider.chat/docs/repomap.html). So the LLM may ask to see additional files if it feels that's needed for your requests.
|
* The LLM can only see the content of the files you specifically "add to the chat". Aider also sends a [map of your entire git repo](https://aider.chat/docs/repomap.html). So the LLM may ask to see additional files if it feels that's needed for your requests.
|
||||||
* I also shared some general [LLM coding tips on Hacker News](https://news.ycombinator.com/item?id=36211879).
|
|
||||||
|
|
||||||
|
## Example chat transcripts
|
||||||
|
|
||||||
|
[The example transcripts page](https://aider.chat/examples/) shows how you can chat with aider to write
|
||||||
|
and edit code.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|
323
_posts/2024-05-13-models-over-time.md
Normal file
323
_posts/2024-05-13-models-over-time.md
Normal file
|
@ -0,0 +1,323 @@
|
||||||
|
---
|
||||||
|
title: Drawing graphs with aider, GPT-4o and matplotlib
|
||||||
|
excerpt: Use GPT-4o to draw graphs with matplotlib, including adjusting styles and making visual changes. You get the graph, but you also get the code in your repo.
|
||||||
|
highlight_image: /assets/models-over-time.png
|
||||||
|
---
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
# Drawing graphs with aider, GPT-4o and matplotlib
|
||||||
|
|
||||||
|
I recently wanted to draw a graph showing how LLM code editing skill has been
|
||||||
|
changing over time as new models have been released by OpenAI, Anthropic and others.
|
||||||
|
I have all the
|
||||||
|
[data in a yaml file](https://github.com/paul-gauthier/aider/blob/main/_data/edit_leaderboard.yml) that is used to render
|
||||||
|
[aider's LLM leaderboards](https://aider.chat/docs/leaderboards/).
|
||||||
|
|
||||||
|
Below is the aider chat transcript, which shows:
|
||||||
|
|
||||||
|
- I launch aider with the yaml file, a file with other plots I've done recently (so GPT can crib the style) and an empty file called `over_time.py`.
|
||||||
|
- Then I ask GPT to draw the scatterplot I want.
|
||||||
|
- I run the resulting script and share the error output with GPT so it can fix a small bug.
|
||||||
|
- I ask it to color the points for GPT-4 and GPT-3.5 family models differently, to better see trends within those model families.
|
||||||
|
- I add a PNG of the graph to the chat, so GPT can see the current graph and understand why I want it to move the point labels so they don't overlap the points.
|
||||||
|
- I work through a series of other small style changes, like changing fonts and the graph border.
|
||||||
|
|
||||||
|
In the end I have the graph, but I also have the python code in my repo.
|
||||||
|
So I can update this graph easily whenever I add new entries to the yaml data file.
|
||||||
|
|
||||||
|
|
||||||
|
## Aider chat transcript
|
||||||
|
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
> Aider v0.35.1-dev
|
||||||
|
> Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo
|
||||||
|
> Added _data/edit_leaderboard.yml to the chat.
|
||||||
|
> Added benchmark/over_time.py to the chat.
|
||||||
|
> Added benchmark/plots.py to the chat.
|
||||||
|
|
||||||
|
#### in over_time.py, draw a graph for each of the yaml entries with a `released` date. plot date on x, `pass_rate_2` on y and label with the `model` name. do a scatter plot. use colors/styles similar to the other graphs.
|
||||||
|
|
||||||
|
To draw a scatter plot for each of the YAML entries with a `released` date, we need to:
|
||||||
|
|
||||||
|
1. Read the YAML file.
|
||||||
|
2. Extract the `released` date and `pass_rate_2` for each entry.
|
||||||
|
3. Plot the data using matplotlib.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
=======
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
import yaml
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def plot_over_time(yaml_file):
|
||||||
|
with open(yaml_file, 'r') as file:
|
||||||
|
data = yaml.safe_load(file)
|
||||||
|
|
||||||
|
dates = []
|
||||||
|
pass_rates = []
|
||||||
|
models = []
|
||||||
|
|
||||||
|
for entry in data:
|
||||||
|
if 'released' in entry and 'pass_rate_2' in entry:
|
||||||
|
dates.append(datetime.strptime(entry['released'], '%Y-%m-%d'))
|
||||||
|
pass_rates.append(entry['pass_rate_2'])
|
||||||
|
models.append(entry['model'])
|
||||||
|
|
||||||
|
plt.figure(figsize=(10, 6))
|
||||||
|
plt.scatter(dates, pass_rates, c='blue', alpha=0.5)
|
||||||
|
|
||||||
|
for i, model in enumerate(models):
|
||||||
|
plt.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
||||||
|
|
||||||
|
plt.xlabel('Release Date')
|
||||||
|
plt.ylabel('Pass Rate 2')
|
||||||
|
plt.title('Model Performance Over Time')
|
||||||
|
plt.grid(True)
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
||||||
|
|
||||||
|
# Example usage
|
||||||
|
plot_over_time('_data/edit_leaderboard.yml')
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 49ac9ca aider: Added scatter plot functionality for YAML entries with a `released` date and `pass_rate_2`.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### /run python benchmark/over_time.py
|
||||||
|
> Traceback (most recent call last):
|
||||||
|
File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 33, in <module>
|
||||||
|
plot_over_time('_data/edit_leaderboard.yml')
|
||||||
|
File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 15, in plot_over_time
|
||||||
|
dates.append(datetime.strptime(entry['released'], '%Y-%m-%d'))
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
TypeError: strptime() argument 1 must be str, not datetime.date
|
||||||
|
> Add the output to the chat? y
|
||||||
|
> Traceback (most recent call last):
|
||||||
|
> File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 33, in <module>
|
||||||
|
> plot_over_time('_data/edit_leaderboard.yml')
|
||||||
|
> File "/Users/gauthier/Projects/aider/benchmark/over_time.py", line 15, in plot_over_time
|
||||||
|
> dates.append(datetime.strptime(entry['released'], '%Y-%m-%d'))
|
||||||
|
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
> TypeError: strptime() argument 1 must be str, not datetime.date
|
||||||
|
|
||||||
|
The error indicates that the `released` field in the YAML file is already a `datetime.date` object, so we don't need to parse it with `datetime.strptime`. We can directly use it in the plot.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
dates.append(datetime.strptime(entry['released'], '%Y-%m-%d'))
|
||||||
|
=======
|
||||||
|
dates.append(entry['released'])
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit af2f4b7 aider: Use the `released` field directly in the plot instead of parsing it with `datetime.strptime`.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### color the "gpt-4" models differently
|
||||||
|
|
||||||
|
To color the "gpt-4" models differently, we need to modify the plotting code in `benchmark/over_time.py` to check for "gpt-4" in the model name and assign a different color.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
plt.scatter(dates, pass_rates, c='blue', alpha=0.5)
|
||||||
|
=======
|
||||||
|
colors = ['red' if 'gpt-4' in model else 'blue' for model in models]
|
||||||
|
plt.scatter(dates, pass_rates, c=colors, alpha=0.5)
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
This change will color the points red if the model name contains "gpt-4", otherwise, it will color them blue.
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 0d11357 aider: Color the "gpt-4" models differently.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### color the gpt-3.5 models a new color
|
||||||
|
|
||||||
|
To color the "gpt-3.5" models a new color, we need to modify the plotting code in `benchmark/over_time.py` to check for "gpt-3.5" in the model name and assign a different color.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
colors = ['red' if 'gpt-4' in model else 'blue' for model in models]
|
||||||
|
=======
|
||||||
|
colors = ['red' if 'gpt-4' in model else 'green' if 'gpt-3.5' in model else 'blue' for model in models]
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 85d9d84 aider: Color the "gpt-3.5" models green in the plotting code.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### use the colorscheme and fonts from the other graphs in plots.py
|
||||||
|
|
||||||
|
To use the colorscheme and fonts from the graphs in `plots.py`, we need to:
|
||||||
|
|
||||||
|
1. Import the necessary settings from `plots.py`.
|
||||||
|
2. Apply these settings to the graph in `over_time.py`.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
import yaml
|
||||||
|
from datetime import datetime
|
||||||
|
=======
|
||||||
|
import yaml
|
||||||
|
from datetime import datetime
|
||||||
|
from matplotlib import rc
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
plt.figure(figsize=(10, 6))
|
||||||
|
=======
|
||||||
|
plt.rcParams["hatch.linewidth"] = 0.5
|
||||||
|
plt.rcParams["hatch.color"] = "#444444"
|
||||||
|
|
||||||
|
rc("font", **{"family": "sans-serif", "sans-serif": ["Helvetica"], "size": 10})
|
||||||
|
|
||||||
|
fig, ax = plt.subplots(figsize=(6, 4))
|
||||||
|
ax.grid(axis="y", zorder=0, lw=0.2)
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
plt.scatter(dates, pass_rates, c=colors, alpha=0.5)
|
||||||
|
=======
|
||||||
|
ax.scatter(dates, pass_rates, c=colors, alpha=0.5)
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
plt.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
||||||
|
|
||||||
|
plt.xlabel('Release Date')
|
||||||
|
plt.ylabel('Pass Rate 2')
|
||||||
|
plt.title('Model Performance Over Time')
|
||||||
|
plt.grid(True)
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.show()
|
||||||
|
=======
|
||||||
|
ax.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
||||||
|
|
||||||
|
ax.set_xlabel('Release Date')
|
||||||
|
ax.set_ylabel('Pass Rate 2')
|
||||||
|
ax.set_title('Model Performance Over Time')
|
||||||
|
plt.tight_layout()
|
||||||
|
plt.savefig("tmp_over_time.svg")
|
||||||
|
imgcat(fig)
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 8d670f1 aider: Used the colorscheme and fonts from the graphs in `plots.py` in `over_time.py`.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### /add tmp_over_time.png
|
||||||
|
> Added /Users/gauthier/Projects/aider/tmp_over_time.png to the chat
|
||||||
|
|
||||||
|
#### make the labels not overlap the dots
|
||||||
|
|
||||||
|
To make the labels not overlap the dots, we can adjust the position of the labels slightly using the `xytext` parameter in the `annotate` function.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
ax.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75)
|
||||||
|
=======
|
||||||
|
ax.annotate(model, (dates[i], pass_rates[i]), fontsize=8, alpha=0.75,
|
||||||
|
xytext=(5, 5), textcoords='offset points')
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Committing benchmark/over_time.py before applying edits.
|
||||||
|
> Commit 49eb72c Updated image file format from SVG to PNG and added imgcat library for displaying the plot.
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 75fa061 aider: Adjust the position of labels to prevent overlap with dots.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### make the dots bigger
|
||||||
|
|
||||||
|
To make the dots bigger, we can adjust the `s` parameter in the `scatter` function, which controls the size of the dots.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
ax.scatter(dates, pass_rates, c=colors, alpha=0.5)
|
||||||
|
=======
|
||||||
|
ax.scatter(dates, pass_rates, c=colors, alpha=0.5, s=100)
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit a018fdf aider: Make the dots bigger.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
#### make the border of the graph thinner and lighter
|
||||||
|
|
||||||
|
To make the border of the graph thinner and lighter, we can adjust the `spines` properties of the axes.
|
||||||
|
|
||||||
|
Here are the changes:
|
||||||
|
|
||||||
|
benchmark/over_time.py
|
||||||
|
```python
|
||||||
|
<<<<<<< SEARCH
|
||||||
|
colors = ['red' if 'gpt-4' in model else 'green' if 'gpt-3.5' in model else 'blue' for model in models]
|
||||||
|
=======
|
||||||
|
for spine in ax.spines.values():
|
||||||
|
spine.set_edgecolor('#DDDDDD')
|
||||||
|
spine.set_linewidth(0.5)
|
||||||
|
|
||||||
|
colors = ['red' if 'gpt-4' in model else 'green' if 'gpt-3.5' in model else 'blue' for model in models]
|
||||||
|
>>>>>>> REPLACE
|
||||||
|
```
|
||||||
|
|
||||||
|
> Applied edit to benchmark/over_time.py
|
||||||
|
> Commit 77ba518 aider: Made the border of the graph thinner and lighter by adjusting the `spines` properties of the axes.
|
||||||
|
|
||||||
|
</div>
|
|
@ -14,8 +14,6 @@ def get_parser(default_config_files, git_root):
|
||||||
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
config_file_parser_class=configargparse.YAMLConfigFileParser,
|
||||||
auto_env_var_prefix="AIDER_",
|
auto_env_var_prefix="AIDER_",
|
||||||
)
|
)
|
||||||
|
|
||||||
##########
|
|
||||||
group = parser.add_argument_group("Main")
|
group = parser.add_argument_group("Main")
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"files",
|
"files",
|
||||||
|
@ -305,12 +303,52 @@ def get_parser(default_config_files, git_root):
|
||||||
default=False,
|
default=False,
|
||||||
help="Perform a dry run without modifying files (default: False)",
|
help="Perform a dry run without modifying files (default: False)",
|
||||||
)
|
)
|
||||||
|
group = parser.add_argument_group("Fixing and committing")
|
||||||
group.add_argument(
|
group.add_argument(
|
||||||
"--commit",
|
"--commit",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Commit all pending changes with a suitable commit message, then exit",
|
help="Commit all pending changes with a suitable commit message, then exit",
|
||||||
default=False,
|
default=False,
|
||||||
)
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--lint",
|
||||||
|
action="store_true",
|
||||||
|
help="Run the linter on all dirty files, fix problems and commit",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--lint-cmd",
|
||||||
|
action="append",
|
||||||
|
help=(
|
||||||
|
'Specify lint commands to run for different languages, eg: "python: flake8'
|
||||||
|
' --select=..." (can be used multiple times)'
|
||||||
|
),
|
||||||
|
default=[],
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--auto-lint",
|
||||||
|
action=argparse.BooleanOptionalAction,
|
||||||
|
default=True,
|
||||||
|
help="Enable/disable automatic linting after changes (default: True)",
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--test-cmd",
|
||||||
|
action="append",
|
||||||
|
help="Specify command to run tests",
|
||||||
|
default=[],
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--auto-test",
|
||||||
|
action=argparse.BooleanOptionalAction,
|
||||||
|
default=False,
|
||||||
|
help="Enable/disable automatic testing after changes (default: False)",
|
||||||
|
)
|
||||||
|
group.add_argument(
|
||||||
|
"--test",
|
||||||
|
action="store_true",
|
||||||
|
help="Run tests and fix problems found",
|
||||||
|
default=False,
|
||||||
|
)
|
||||||
|
|
||||||
##########
|
##########
|
||||||
group = parser.add_argument_group("Other Settings")
|
group = parser.add_argument_group("Other Settings")
|
||||||
|
|
|
@ -21,6 +21,7 @@ from aider import __version__, models, prompts, utils
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
from aider.history import ChatSummary
|
from aider.history import ChatSummary
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
|
from aider.linter import Linter
|
||||||
from aider.litellm import litellm
|
from aider.litellm import litellm
|
||||||
from aider.mdstream import MarkdownStream
|
from aider.mdstream import MarkdownStream
|
||||||
from aider.repo import GitRepo
|
from aider.repo import GitRepo
|
||||||
|
@ -55,10 +56,16 @@ class Coder:
|
||||||
num_exhausted_context_windows = 0
|
num_exhausted_context_windows = 0
|
||||||
num_malformed_responses = 0
|
num_malformed_responses = 0
|
||||||
last_keyboard_interrupt = None
|
last_keyboard_interrupt = None
|
||||||
max_apply_update_errors = 3
|
num_reflections = 0
|
||||||
|
max_reflections = 3
|
||||||
edit_format = None
|
edit_format = None
|
||||||
yield_stream = False
|
yield_stream = False
|
||||||
temperature = 0
|
temperature = 0
|
||||||
|
auto_lint = True
|
||||||
|
auto_test = False
|
||||||
|
test_cmd = None
|
||||||
|
lint_outcome = None
|
||||||
|
test_outcome = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(
|
def create(
|
||||||
|
@ -195,6 +202,10 @@ class Coder:
|
||||||
done_messages=None,
|
done_messages=None,
|
||||||
max_chat_history_tokens=None,
|
max_chat_history_tokens=None,
|
||||||
restore_chat_history=False,
|
restore_chat_history=False,
|
||||||
|
auto_lint=True,
|
||||||
|
auto_test=False,
|
||||||
|
lint_cmds=None,
|
||||||
|
test_cmd=None,
|
||||||
):
|
):
|
||||||
if not fnames:
|
if not fnames:
|
||||||
fnames = []
|
fnames = []
|
||||||
|
@ -305,6 +316,14 @@ class Coder:
|
||||||
self.done_messages = utils.split_chat_history_markdown(history_md)
|
self.done_messages = utils.split_chat_history_markdown(history_md)
|
||||||
self.summarize_start()
|
self.summarize_start()
|
||||||
|
|
||||||
|
# Linting and testing
|
||||||
|
self.linter = Linter(root=self.root, encoding=io.encoding)
|
||||||
|
self.auto_lint = auto_lint
|
||||||
|
self.setup_lint_cmds(lint_cmds)
|
||||||
|
|
||||||
|
self.auto_test = auto_test
|
||||||
|
self.test_cmd = test_cmd
|
||||||
|
|
||||||
# validate the functions jsonschema
|
# validate the functions jsonschema
|
||||||
if self.functions:
|
if self.functions:
|
||||||
for function in self.functions:
|
for function in self.functions:
|
||||||
|
@ -314,6 +333,12 @@ class Coder:
|
||||||
self.io.tool_output("JSON Schema:")
|
self.io.tool_output("JSON Schema:")
|
||||||
self.io.tool_output(json.dumps(self.functions, indent=4))
|
self.io.tool_output(json.dumps(self.functions, indent=4))
|
||||||
|
|
||||||
|
def setup_lint_cmds(self, lint_cmds):
|
||||||
|
if not lint_cmds:
|
||||||
|
return
|
||||||
|
for lang, cmd in lint_cmds.items():
|
||||||
|
self.linter.set_linter(lang, cmd)
|
||||||
|
|
||||||
def show_announcements(self):
|
def show_announcements(self):
|
||||||
for line in self.get_announcements():
|
for line in self.get_announcements():
|
||||||
self.io.tool_output(line)
|
self.io.tool_output(line)
|
||||||
|
@ -524,12 +549,20 @@ class Coder:
|
||||||
|
|
||||||
def run_stream(self, user_message):
|
def run_stream(self, user_message):
|
||||||
self.io.user_input(user_message)
|
self.io.user_input(user_message)
|
||||||
self.reflected_message = None
|
self.init_before_message()
|
||||||
yield from self.send_new_user_message(user_message)
|
yield from self.send_new_user_message(user_message)
|
||||||
|
|
||||||
|
def init_before_message(self):
|
||||||
|
self.reflected_message = None
|
||||||
|
self.num_reflections = 0
|
||||||
|
self.lint_outcome = None
|
||||||
|
self.test_outcome = None
|
||||||
|
self.edit_outcome = None
|
||||||
|
|
||||||
def run(self, with_message=None):
|
def run(self, with_message=None):
|
||||||
while True:
|
while True:
|
||||||
self.num_malformed_responses = 0
|
self.init_before_message()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if with_message:
|
if with_message:
|
||||||
new_user_message = with_message
|
new_user_message = with_message
|
||||||
|
@ -540,7 +573,14 @@ class Coder:
|
||||||
while new_user_message:
|
while new_user_message:
|
||||||
self.reflected_message = None
|
self.reflected_message = None
|
||||||
list(self.send_new_user_message(new_user_message))
|
list(self.send_new_user_message(new_user_message))
|
||||||
new_user_message = self.reflected_message
|
if self.num_reflections < self.max_reflections:
|
||||||
|
self.num_reflections += 1
|
||||||
|
new_user_message = self.reflected_message
|
||||||
|
else:
|
||||||
|
self.io.tool_error(
|
||||||
|
f"Only {self.max_reflections} reflections allowed, stopping."
|
||||||
|
)
|
||||||
|
new_user_message = None
|
||||||
|
|
||||||
if with_message:
|
if with_message:
|
||||||
return self.partial_response_content
|
return self.partial_response_content
|
||||||
|
@ -761,10 +801,33 @@ class Coder:
|
||||||
self.cur_messages += [dict(role="assistant", content=content)]
|
self.cur_messages += [dict(role="assistant", content=content)]
|
||||||
return
|
return
|
||||||
|
|
||||||
edited, edit_error = self.apply_updates()
|
edited = self.apply_updates()
|
||||||
if edit_error:
|
if self.reflected_message:
|
||||||
|
self.edit_outcome = False
|
||||||
self.update_cur_messages(set())
|
self.update_cur_messages(set())
|
||||||
self.reflected_message = edit_error
|
return
|
||||||
|
if edited:
|
||||||
|
self.edit_outcome = True
|
||||||
|
|
||||||
|
if edited and self.auto_lint:
|
||||||
|
lint_errors = self.lint_edited(edited)
|
||||||
|
self.lint_outcome = not lint_errors
|
||||||
|
if lint_errors:
|
||||||
|
ok = self.io.confirm_ask("Attempt to fix lint errors?")
|
||||||
|
if ok:
|
||||||
|
self.reflected_message = lint_errors
|
||||||
|
self.update_cur_messages(set())
|
||||||
|
return
|
||||||
|
|
||||||
|
if edited and self.auto_test:
|
||||||
|
test_errors = self.commands.cmd_test(self.test_cmd)
|
||||||
|
self.test_outcome = not test_errors
|
||||||
|
if test_errors:
|
||||||
|
ok = self.io.confirm_ask("Attempt to fix test errors?")
|
||||||
|
if ok:
|
||||||
|
self.reflected_message = test_errors
|
||||||
|
self.update_cur_messages(set())
|
||||||
|
return
|
||||||
|
|
||||||
self.update_cur_messages(edited)
|
self.update_cur_messages(edited)
|
||||||
|
|
||||||
|
@ -786,6 +849,20 @@ class Coder:
|
||||||
else:
|
else:
|
||||||
self.reflected_message = add_rel_files_message
|
self.reflected_message = add_rel_files_message
|
||||||
|
|
||||||
|
def lint_edited(self, fnames):
|
||||||
|
res = ""
|
||||||
|
for fname in fnames:
|
||||||
|
errors = self.linter.lint(self.abs_root_path(fname))
|
||||||
|
if errors:
|
||||||
|
res += "\n"
|
||||||
|
res += errors
|
||||||
|
res += "\n"
|
||||||
|
|
||||||
|
if res:
|
||||||
|
self.io.tool_error(res)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
def update_cur_messages(self, edited):
|
def update_cur_messages(self, edited):
|
||||||
if self.partial_response_content:
|
if self.partial_response_content:
|
||||||
self.cur_messages += [dict(role="assistant", content=self.partial_response_content)]
|
self.cur_messages += [dict(role="assistant", content=self.partial_response_content)]
|
||||||
|
@ -1114,8 +1191,6 @@ class Coder:
|
||||||
)
|
)
|
||||||
self.warning_given = True
|
self.warning_given = True
|
||||||
|
|
||||||
apply_update_errors = 0
|
|
||||||
|
|
||||||
def prepare_to_edit(self, edits):
|
def prepare_to_edit(self, edits):
|
||||||
res = []
|
res = []
|
||||||
seen = dict()
|
seen = dict()
|
||||||
|
@ -1149,37 +1224,30 @@ class Coder:
|
||||||
edited = self.update_files()
|
edited = self.update_files()
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
self.num_malformed_responses += 1
|
self.num_malformed_responses += 1
|
||||||
|
|
||||||
err = err.args[0]
|
err = err.args[0]
|
||||||
self.apply_update_errors += 1
|
|
||||||
if self.apply_update_errors < self.max_apply_update_errors:
|
self.io.tool_error("The LLM did not conform to the edit format.")
|
||||||
self.io.tool_error(f"Malformed response #{self.apply_update_errors}, retrying...")
|
self.io.tool_error(
|
||||||
self.io.tool_error("https://aider.chat/docs/faq.html#aider-isnt-editing-my-files")
|
"For more info see: https://aider.chat/docs/faq.html#aider-isnt-editing-my-files"
|
||||||
self.io.tool_error(str(err), strip=False)
|
)
|
||||||
return None, err
|
self.io.tool_error()
|
||||||
else:
|
self.io.tool_error(str(err), strip=False)
|
||||||
self.io.tool_error(f"Malformed response #{self.apply_update_errors}, aborting.")
|
|
||||||
self.io.tool_error("https://aider.chat/docs/faq.html#aider-isnt-editing-my-files")
|
self.reflected_message = str(err)
|
||||||
self.io.tool_error(str(err), strip=False)
|
return
|
||||||
return False, None
|
|
||||||
|
|
||||||
except git.exc.GitCommandError as err:
|
except git.exc.GitCommandError as err:
|
||||||
self.io.tool_error(str(err))
|
self.io.tool_error(str(err))
|
||||||
return False, None
|
return
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(err)
|
self.io.tool_error("Exception while updating files:")
|
||||||
print()
|
self.io.tool_error(str(err), strip=False)
|
||||||
traceback.print_exc()
|
|
||||||
self.apply_update_errors += 1
|
|
||||||
if self.apply_update_errors < self.max_apply_update_errors:
|
|
||||||
self.io.tool_error(f"Update exception #{self.apply_update_errors}, retrying...")
|
|
||||||
self.io.tool_error(str(err), strip=False)
|
|
||||||
return None, str(err)
|
|
||||||
else:
|
|
||||||
self.io.tool_error(f"Update exception #{self.apply_update_errors}, aborting")
|
|
||||||
self.io.tool_error(str(err), strip=False)
|
|
||||||
return False, None
|
|
||||||
|
|
||||||
self.apply_update_errors = 0
|
traceback.print_exc()
|
||||||
|
|
||||||
|
self.reflected_message = str(err)
|
||||||
|
return
|
||||||
|
|
||||||
for path in edited:
|
for path in edited:
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
|
@ -1187,7 +1255,7 @@ class Coder:
|
||||||
else:
|
else:
|
||||||
self.io.tool_output(f"Applied edit to {path}")
|
self.io.tool_output(f"Applied edit to {path}")
|
||||||
|
|
||||||
return edited, None
|
return edited
|
||||||
|
|
||||||
def parse_partial_args(self):
|
def parse_partial_args(self):
|
||||||
# dump(self.partial_response_function_call)
|
# dump(self.partial_response_function_call)
|
||||||
|
|
|
@ -124,6 +124,9 @@ Every *SEARCH/REPLACE block* must use this format:
|
||||||
|
|
||||||
Every *SEARCH* section must *EXACTLY MATCH* the existing source code, character for character, including all comments, docstrings, etc.
|
Every *SEARCH* section must *EXACTLY MATCH* the existing source code, character for character, including all comments, docstrings, etc.
|
||||||
|
|
||||||
|
*SEARCH/REPLACE* blocks will replace *all* matching occurrences.
|
||||||
|
Include enough lines to make the SEARCH blocks unique.
|
||||||
|
|
||||||
Include *ALL* the code being searched and replaced!
|
Include *ALL* the code being searched and replaced!
|
||||||
|
|
||||||
Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat!
|
Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat!
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from aider import diffs
|
from aider import diffs
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from ..dump import dump # noqa: F401
|
from ..dump import dump # noqa: F401
|
||||||
from .base_coder import Coder
|
from .base_coder import Coder
|
||||||
|
|
|
@ -153,7 +153,43 @@ class Commands:
|
||||||
commit_message = args.strip()
|
commit_message = args.strip()
|
||||||
self.coder.repo.commit(message=commit_message)
|
self.coder.repo.commit(message=commit_message)
|
||||||
|
|
||||||
def cmd_clear(self, args=""):
|
def cmd_lint(self, args):
|
||||||
|
"Commit, run the linter on all dirty files, fix problems and commit again"
|
||||||
|
|
||||||
|
if not self.coder.repo:
|
||||||
|
self.io.tool_error("No git repository found.")
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.coder.repo.is_dirty():
|
||||||
|
self.io.tool_error("No more changes to commit.")
|
||||||
|
return
|
||||||
|
|
||||||
|
fnames = self.coder.repo.get_dirty_files()
|
||||||
|
linted = False
|
||||||
|
for fname in fnames:
|
||||||
|
try:
|
||||||
|
errors = self.coder.linter.lint(fname, cmd=args)
|
||||||
|
linted = True
|
||||||
|
except FileNotFoundError as err:
|
||||||
|
self.io.tool_error(f"Unable to lint {fname}")
|
||||||
|
self.io.tool_error(str(err))
|
||||||
|
continue
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
# Commit everything before we start fixing lint errors
|
||||||
|
if self.coder.repo.is_dirty():
|
||||||
|
self.cmd_commit("")
|
||||||
|
|
||||||
|
self.io.tool_error(errors)
|
||||||
|
|
||||||
|
abs_file_path = self.coder.abs_root_path(fname)
|
||||||
|
self.coder.abs_fnames.add(abs_file_path)
|
||||||
|
self.coder.run(errors)
|
||||||
|
|
||||||
|
if linted and self.coder.repo.is_dirty():
|
||||||
|
self.cmd_commit("")
|
||||||
|
|
||||||
|
def cmd_clear(self, args):
|
||||||
"Clear the chat history"
|
"Clear the chat history"
|
||||||
|
|
||||||
self.coder.done_messages = []
|
self.coder.done_messages = []
|
||||||
|
|
236
aider/linter.py
Normal file
236
aider/linter.py
Normal file
|
@ -0,0 +1,236 @@
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
import warnings
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from grep_ast import TreeContext, filename_to_lang
|
||||||
|
from tree_sitter_languages import get_parser # noqa: E402
|
||||||
|
|
||||||
|
# tree_sitter is throwing a FutureWarning
|
||||||
|
warnings.simplefilter("ignore", category=FutureWarning)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Linter:
|
||||||
|
def __init__(self, encoding="utf-8", root=None):
|
||||||
|
self.encoding = encoding
|
||||||
|
self.root = root
|
||||||
|
|
||||||
|
self.languages = dict(
|
||||||
|
python=self.py_lint,
|
||||||
|
)
|
||||||
|
|
||||||
|
def set_linter(self, lang, cmd):
|
||||||
|
self.languages[lang] = cmd
|
||||||
|
|
||||||
|
def get_rel_fname(self, fname):
|
||||||
|
if self.root:
|
||||||
|
return os.path.relpath(fname, self.root)
|
||||||
|
else:
|
||||||
|
return fname
|
||||||
|
|
||||||
|
def run_cmd(self, cmd, rel_fname, code):
|
||||||
|
cmd += " " + rel_fname
|
||||||
|
cmd = cmd.split()
|
||||||
|
|
||||||
|
process = subprocess.Popen(
|
||||||
|
cmd, cwd=self.root, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
|
||||||
|
)
|
||||||
|
stdout, _ = process.communicate()
|
||||||
|
errors = stdout.decode()
|
||||||
|
if process.returncode == 0:
|
||||||
|
return # zero exit status
|
||||||
|
|
||||||
|
cmd = " ".join(cmd)
|
||||||
|
res = f"## Running: {cmd}\n\n"
|
||||||
|
res += errors
|
||||||
|
|
||||||
|
linenums = []
|
||||||
|
filenames_linenums = find_filenames_and_linenums(errors, [rel_fname])
|
||||||
|
if filenames_linenums:
|
||||||
|
filename, linenums = next(iter(filenames_linenums.items()))
|
||||||
|
linenums = [num - 1 for num in linenums]
|
||||||
|
|
||||||
|
return LintResult(text=res, lines=linenums)
|
||||||
|
|
||||||
|
def lint(self, fname, cmd=None):
|
||||||
|
rel_fname = self.get_rel_fname(fname)
|
||||||
|
code = Path(fname).read_text(self.encoding)
|
||||||
|
|
||||||
|
if cmd:
|
||||||
|
cmd = cmd.strip()
|
||||||
|
if not cmd:
|
||||||
|
lang = filename_to_lang(fname)
|
||||||
|
if not lang:
|
||||||
|
return
|
||||||
|
cmd = self.languages.get(lang)
|
||||||
|
|
||||||
|
if callable(cmd):
|
||||||
|
linkres = cmd(fname, rel_fname, code)
|
||||||
|
elif cmd:
|
||||||
|
linkres = self.run_cmd(cmd, rel_fname, code)
|
||||||
|
else:
|
||||||
|
linkres = basic_lint(rel_fname, code)
|
||||||
|
|
||||||
|
if not linkres:
|
||||||
|
return
|
||||||
|
|
||||||
|
res = "# Fix any errors below, if possible.\n\n"
|
||||||
|
res += linkres.text
|
||||||
|
res += "\n"
|
||||||
|
res += tree_context(fname, code, linkres.lines)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
def py_lint(self, fname, rel_fname, code):
|
||||||
|
result = ""
|
||||||
|
basic_res = basic_lint(rel_fname, code)
|
||||||
|
compile_res = lint_python_compile(fname, code)
|
||||||
|
|
||||||
|
fatal = "E9,F821,F823,F831,F406,F407,F701,F702,F704,F706"
|
||||||
|
flake8 = f"flake8 --select={fatal} --show-source"
|
||||||
|
|
||||||
|
try:
|
||||||
|
flake_res = self.run_cmd(flake8, rel_fname, code)
|
||||||
|
except FileNotFoundError:
|
||||||
|
flake_res = None
|
||||||
|
|
||||||
|
text = ""
|
||||||
|
lines = set()
|
||||||
|
for res in [basic_res, compile_res, flake_res]:
|
||||||
|
if not res:
|
||||||
|
continue
|
||||||
|
if text:
|
||||||
|
text += "\n"
|
||||||
|
text += res.text
|
||||||
|
lines.update(res.lines)
|
||||||
|
|
||||||
|
if text or lines:
|
||||||
|
return LintResult(text, lines)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class LintResult:
|
||||||
|
text: str
|
||||||
|
lines: list
|
||||||
|
|
||||||
|
|
||||||
|
def lint_python_compile(fname, code):
|
||||||
|
try:
|
||||||
|
compile(code, fname, "exec") # USE TRACEBACK BELOW HERE
|
||||||
|
return
|
||||||
|
except Exception as err:
|
||||||
|
line_numbers = list(range(err.lineno - 1, err.end_lineno))
|
||||||
|
|
||||||
|
tb_lines = traceback.format_exception(type(err), err, err.__traceback__)
|
||||||
|
last_file_i = 0
|
||||||
|
|
||||||
|
target = "# USE TRACEBACK"
|
||||||
|
target += " BELOW HERE"
|
||||||
|
for i in range(len(tb_lines)):
|
||||||
|
if target in tb_lines[i]:
|
||||||
|
last_file_i = i
|
||||||
|
break
|
||||||
|
|
||||||
|
tb_lines = tb_lines[:1] + tb_lines[last_file_i + 1 :]
|
||||||
|
|
||||||
|
res = "".join(tb_lines)
|
||||||
|
return LintResult(text=res, lines=line_numbers)
|
||||||
|
|
||||||
|
|
||||||
|
def basic_lint(fname, code):
|
||||||
|
"""
|
||||||
|
Use tree-sitter to look for syntax errors, display them with tree context.
|
||||||
|
"""
|
||||||
|
|
||||||
|
lang = filename_to_lang(fname)
|
||||||
|
if not lang:
|
||||||
|
return
|
||||||
|
|
||||||
|
parser = get_parser(lang)
|
||||||
|
tree = parser.parse(bytes(code, "utf-8"))
|
||||||
|
|
||||||
|
errors = traverse_tree(tree.root_node)
|
||||||
|
if not errors:
|
||||||
|
return
|
||||||
|
|
||||||
|
return LintResult(text="", lines=errors)
|
||||||
|
|
||||||
|
|
||||||
|
def tree_context(fname, code, line_nums):
|
||||||
|
context = TreeContext(
|
||||||
|
fname,
|
||||||
|
code,
|
||||||
|
color=False,
|
||||||
|
line_number=True,
|
||||||
|
child_context=False,
|
||||||
|
last_line=False,
|
||||||
|
margin=0,
|
||||||
|
mark_lois=True,
|
||||||
|
loi_pad=3,
|
||||||
|
# header_max=30,
|
||||||
|
show_top_of_file_parent_scope=False,
|
||||||
|
)
|
||||||
|
line_nums = set(line_nums)
|
||||||
|
context.add_lines_of_interest(line_nums)
|
||||||
|
context.add_context()
|
||||||
|
s = "s" if len(line_nums) > 1 else ""
|
||||||
|
output = f"## See relevant line{s} below marked with █.\n\n"
|
||||||
|
output += fname + ":\n"
|
||||||
|
output += context.format()
|
||||||
|
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
# Traverse the tree to find errors
|
||||||
|
def traverse_tree(node):
|
||||||
|
errors = []
|
||||||
|
if node.type == "ERROR" or node.is_missing:
|
||||||
|
line_no = node.start_point[0]
|
||||||
|
errors.append(line_no)
|
||||||
|
|
||||||
|
for child in node.children:
|
||||||
|
errors += traverse_tree(child)
|
||||||
|
|
||||||
|
return errors
|
||||||
|
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def find_filenames_and_linenums(text, fnames):
|
||||||
|
"""
|
||||||
|
Search text for all occurrences of <filename>:\d+ and make a list of them
|
||||||
|
where <filename> is one of the filenames in the list `fnames`.
|
||||||
|
"""
|
||||||
|
pattern = re.compile(r"(\b(?:" + "|".join(re.escape(fname) for fname in fnames) + r"):\d+\b)")
|
||||||
|
matches = pattern.findall(text)
|
||||||
|
result = {}
|
||||||
|
for match in matches:
|
||||||
|
fname, linenum = match.rsplit(":", 1)
|
||||||
|
if fname not in result:
|
||||||
|
result[fname] = set()
|
||||||
|
result[fname].add(int(linenum))
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""
|
||||||
|
Main function to parse files provided as command line arguments.
|
||||||
|
"""
|
||||||
|
if len(sys.argv) < 2:
|
||||||
|
print("Usage: python linter.py <file1> <file2> ...")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
linter = Linter(root=os.getcwd())
|
||||||
|
for file_path in sys.argv[1:]:
|
||||||
|
errors = linter.lint(file_path)
|
||||||
|
if errors:
|
||||||
|
print(errors)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
|
@ -8,4 +8,6 @@ os.environ["OR_APP_NAME"] = "Aider"
|
||||||
|
|
||||||
import litellm # noqa: E402
|
import litellm # noqa: E402
|
||||||
|
|
||||||
|
litellm.suppress_debug_info = True
|
||||||
|
|
||||||
__all__ = [litellm]
|
__all__ = [litellm]
|
||||||
|
|
|
@ -177,6 +177,29 @@ def launch_gui(args):
|
||||||
# sys.argv = ['streamlit', 'run', '--'] + args
|
# sys.argv = ['streamlit', 'run', '--'] + args
|
||||||
|
|
||||||
|
|
||||||
|
def parse_lint_cmds(lint_cmds, io):
|
||||||
|
err = False
|
||||||
|
res = dict()
|
||||||
|
for lint_cmd in lint_cmds:
|
||||||
|
pieces = lint_cmd.split(":")
|
||||||
|
lang = pieces[0]
|
||||||
|
cmd = lint_cmd[len(lang) + 1 :]
|
||||||
|
|
||||||
|
lang = lang.strip()
|
||||||
|
cmd = cmd.strip()
|
||||||
|
|
||||||
|
if lang and cmd:
|
||||||
|
res[lang] = cmd
|
||||||
|
else:
|
||||||
|
io.tool_error(f'Unable to parse --lint-cmd "{lint_cmd}"')
|
||||||
|
io.tool_error('The arg should be "language: cmd --args ..."')
|
||||||
|
io.tool_error('For example: --lint-cmd "python: flake8 --select=E9"')
|
||||||
|
err = True
|
||||||
|
if err:
|
||||||
|
return
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None, input=None, output=None, force_git_root=None, return_coder=False):
|
def main(argv=None, input=None, output=None, force_git_root=None, return_coder=False):
|
||||||
if argv is None:
|
if argv is None:
|
||||||
argv = sys.argv[1:]
|
argv = sys.argv[1:]
|
||||||
|
@ -306,6 +329,10 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
|
|
||||||
main_model = models.Model(args.model, weak_model=args.weak_model)
|
main_model = models.Model(args.model, weak_model=args.weak_model)
|
||||||
|
|
||||||
|
lint_cmds = parse_lint_cmds(args.lint_cmd, io)
|
||||||
|
if lint_cmds is None:
|
||||||
|
return 1
|
||||||
|
|
||||||
if args.show_model_warnings:
|
if args.show_model_warnings:
|
||||||
models.sanity_check_models(io, main_model)
|
models.sanity_check_models(io, main_model)
|
||||||
|
|
||||||
|
@ -332,6 +359,10 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
aider_ignore_file=args.aiderignore,
|
aider_ignore_file=args.aiderignore,
|
||||||
max_chat_history_tokens=args.max_chat_history_tokens,
|
max_chat_history_tokens=args.max_chat_history_tokens,
|
||||||
restore_chat_history=args.restore_chat_history,
|
restore_chat_history=args.restore_chat_history,
|
||||||
|
auto_lint=args.auto_lint,
|
||||||
|
auto_test=args.auto_test,
|
||||||
|
lint_cmds=lint_cmds,
|
||||||
|
test_cmd=args.test_cmd,
|
||||||
)
|
)
|
||||||
|
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
|
@ -355,6 +386,19 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
coder.commands.cmd_commit("")
|
coder.commands.cmd_commit("")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if args.lint:
|
||||||
|
coder.commands.cmd_lint("")
|
||||||
|
return
|
||||||
|
|
||||||
|
if args.test:
|
||||||
|
if not args.test_cmd:
|
||||||
|
io.tool_error("No --test-cmd provided.")
|
||||||
|
return 1
|
||||||
|
test_errors = coder.commands.cmd_test(args.test_cmd)
|
||||||
|
if test_errors:
|
||||||
|
coder.run(test_errors)
|
||||||
|
return
|
||||||
|
|
||||||
if args.show_repo_map:
|
if args.show_repo_map:
|
||||||
repo_map = coder.get_repo_map()
|
repo_map = coder.get_repo_map()
|
||||||
if repo_map:
|
if repo_map:
|
||||||
|
|
|
@ -242,6 +242,23 @@ class GitRepo:
|
||||||
res = Path(self.root) / path
|
res = Path(self.root) / path
|
||||||
return utils.safe_abs_path(res)
|
return utils.safe_abs_path(res)
|
||||||
|
|
||||||
|
def get_dirty_files(self):
|
||||||
|
"""
|
||||||
|
Returns a list of all files which are dirty (not committed), either staged or in the working
|
||||||
|
directory.
|
||||||
|
"""
|
||||||
|
dirty_files = set()
|
||||||
|
|
||||||
|
# Get staged files
|
||||||
|
staged_files = self.repo.git.diff("--name-only", "--cached").splitlines()
|
||||||
|
dirty_files.update(staged_files)
|
||||||
|
|
||||||
|
# Get unstaged files
|
||||||
|
unstaged_files = self.repo.git.diff("--name-only").splitlines()
|
||||||
|
dirty_files.update(unstaged_files)
|
||||||
|
|
||||||
|
return list(dirty_files)
|
||||||
|
|
||||||
def is_dirty(self, path=None):
|
def is_dirty(self, path=None):
|
||||||
if path and not self.path_in_repo(path):
|
if path and not self.path_in_repo(path):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
color: #0f0;
|
color: #0f0;
|
||||||
padding: 1em 1em 1em 1em;
|
padding: 1em 1em 1em 1em;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
margin-top: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-transcript blockquote {
|
.chat-transcript blockquote {
|
||||||
|
|
BIN
assets/models-over-time.png
Normal file
BIN
assets/models-over-time.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 86 KiB |
|
@ -317,6 +317,7 @@ def summarize_results(dirname):
|
||||||
res.test_timeouts = 0
|
res.test_timeouts = 0
|
||||||
res.exhausted_context_windows = 0
|
res.exhausted_context_windows = 0
|
||||||
res.num_malformed_responses = 0
|
res.num_malformed_responses = 0
|
||||||
|
res.num_with_malformed_responses = 0
|
||||||
res.syntax_errors = 0
|
res.syntax_errors = 0
|
||||||
res.indentation_errors = 0
|
res.indentation_errors = 0
|
||||||
res.lazy_comments = 0
|
res.lazy_comments = 0
|
||||||
|
@ -342,6 +343,8 @@ def summarize_results(dirname):
|
||||||
res.user_asks += results.get("num_user_asks", 0)
|
res.user_asks += results.get("num_user_asks", 0)
|
||||||
res.exhausted_context_windows += results.get("num_exhausted_context_windows", 0)
|
res.exhausted_context_windows += results.get("num_exhausted_context_windows", 0)
|
||||||
res.num_malformed_responses += results.get("num_malformed_responses", 0)
|
res.num_malformed_responses += results.get("num_malformed_responses", 0)
|
||||||
|
if results.get("num_malformed_responses"):
|
||||||
|
res.num_with_malformed_responses += 1
|
||||||
res.lazy_comments += results.get("lazy_comments", 0)
|
res.lazy_comments += results.get("lazy_comments", 0)
|
||||||
|
|
||||||
res.syntax_errors += results.get("syntax_errors", 0)
|
res.syntax_errors += results.get("syntax_errors", 0)
|
||||||
|
@ -392,11 +395,12 @@ def summarize_results(dirname):
|
||||||
for i in range(tries):
|
for i in range(tries):
|
||||||
print(f" pass_rate_{i+1}: {percents[i]:.1f}")
|
print(f" pass_rate_{i+1}: {percents[i]:.1f}")
|
||||||
|
|
||||||
pct_well_formed = 1.0 - res.num_malformed_responses / res.completed_tests
|
pct_well_formed = 1.0 - res.num_with_malformed_responses / res.completed_tests
|
||||||
print(f" percent_cases_well_formed: {pct_well_formed*100:.1f}")
|
print(f" percent_cases_well_formed: {pct_well_formed*100:.1f}")
|
||||||
|
|
||||||
show("error_outputs")
|
show("error_outputs")
|
||||||
show("num_malformed_responses")
|
show("num_malformed_responses")
|
||||||
|
show("num_with_malformed_responses")
|
||||||
show("user_asks")
|
show("user_asks")
|
||||||
show("lazy_comments")
|
show("lazy_comments")
|
||||||
show("syntax_errors")
|
show("syntax_errors")
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
# This file is autogenerated by pip-compile with Python 3.11
|
# This file is autogenerated by pip-compile with Python 3.11
|
||||||
# by the following command:
|
# by the following command:
|
||||||
#
|
#
|
||||||
# pip-compile dev-requirements.in
|
# pip-compile --output-file=dev-requirements.txt dev-requirements.in
|
||||||
#
|
#
|
||||||
alabaster==0.7.16
|
alabaster==0.7.16
|
||||||
# via sphinx
|
# via sphinx
|
||||||
babel==2.14.0
|
babel==2.15.0
|
||||||
# via sphinx
|
# via sphinx
|
||||||
build==1.2.1
|
build==1.2.1
|
||||||
# via pip-tools
|
# via pip-tools
|
||||||
|
@ -48,7 +48,7 @@ imgcat==0.5.0
|
||||||
# via -r dev-requirements.in
|
# via -r dev-requirements.in
|
||||||
iniconfig==2.0.0
|
iniconfig==2.0.0
|
||||||
# via pytest
|
# via pytest
|
||||||
jinja2==3.1.3
|
jinja2==3.1.4
|
||||||
# via sphinx
|
# via sphinx
|
||||||
kiwisolver==1.4.5
|
kiwisolver==1.4.5
|
||||||
# via matplotlib
|
# via matplotlib
|
||||||
|
@ -58,7 +58,7 @@ markdown-it-py==3.0.0
|
||||||
# via rich
|
# via rich
|
||||||
markupsafe==2.1.5
|
markupsafe==2.1.5
|
||||||
# via jinja2
|
# via jinja2
|
||||||
matplotlib==3.8.4
|
matplotlib==3.9.0
|
||||||
# via -r dev-requirements.in
|
# via -r dev-requirements.in
|
||||||
mdurl==0.1.2
|
mdurl==0.1.2
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
|
@ -85,7 +85,7 @@ pillow==10.3.0
|
||||||
# via matplotlib
|
# via matplotlib
|
||||||
pip-tools==7.4.1
|
pip-tools==7.4.1
|
||||||
# via -r dev-requirements.in
|
# via -r dev-requirements.in
|
||||||
platformdirs==4.2.1
|
platformdirs==4.2.2
|
||||||
# via virtualenv
|
# via virtualenv
|
||||||
pluggy==1.5.0
|
pluggy==1.5.0
|
||||||
# via pytest
|
# via pytest
|
||||||
|
@ -93,9 +93,9 @@ pox==0.3.4
|
||||||
# via pathos
|
# via pathos
|
||||||
ppft==1.7.6.8
|
ppft==1.7.6.8
|
||||||
# via pathos
|
# via pathos
|
||||||
pre-commit==3.7.0
|
pre-commit==3.7.1
|
||||||
# via -r dev-requirements.in
|
# via -r dev-requirements.in
|
||||||
pygments==2.17.2
|
pygments==2.18.0
|
||||||
# via
|
# via
|
||||||
# rich
|
# rich
|
||||||
# sphinx
|
# sphinx
|
||||||
|
@ -153,7 +153,7 @@ tzdata==2024.1
|
||||||
# via pandas
|
# via pandas
|
||||||
urllib3==2.2.1
|
urllib3==2.2.1
|
||||||
# via requests
|
# via requests
|
||||||
virtualenv==20.26.1
|
virtualenv==20.26.2
|
||||||
# via pre-commit
|
# via pre-commit
|
||||||
wheel==0.43.0
|
wheel==0.43.0
|
||||||
# via pip-tools
|
# via pip-tools
|
||||||
|
|
|
@ -37,6 +37,5 @@ The interactive prompt is built with [prompt-toolkit](https://github.com/prompt-
|
||||||
- `Ctrl-P` : Move up to the previous history entry.
|
- `Ctrl-P` : Move up to the previous history entry.
|
||||||
- `Ctrl-R` : Reverse search in command history.
|
- `Ctrl-R` : Reverse search in command history.
|
||||||
|
|
||||||
Note: aider currently exits vi normal mode after a single command, (maybe something to do with the esc keybinding?). Feel free to investigate and make a PR if you would like to see it fully supported.
|
Note: aider currently exits vi normal mode after a single command, (maybe something to do with the esc keybinding?).
|
||||||
|
Feel free to investigate and make a PR if you would like to see it fully supported.
|
||||||
Prompt toolkit also does not provide clear documentation on the bindings they support - maybe you can take aider and help them out with that and we can then link to the authoritative docs.
|
|
||||||
|
|
|
@ -29,8 +29,8 @@ To work with Anthropic's models like Claude 3 Opus you need a paid
|
||||||
# Install aider
|
# Install aider
|
||||||
py -m pip install aider-chat
|
py -m pip install aider-chat
|
||||||
|
|
||||||
# To work with GPT-4 Turbo:
|
# To work with GPT-4o:
|
||||||
$ aider --openai-api-key sk-xxx... --4turbo
|
$ aider --openai-api-key sk-xxx...
|
||||||
|
|
||||||
# To work with Claude 3 Opus:
|
# To work with Claude 3 Opus:
|
||||||
$ aider --anthropic-api-key sk-xxx... --opus
|
$ aider --anthropic-api-key sk-xxx... --opus
|
||||||
|
@ -42,8 +42,8 @@ $ aider --anthropic-api-key sk-xxx... --opus
|
||||||
# Install aider
|
# Install aider
|
||||||
python -m pip install aider-chat
|
python -m pip install aider-chat
|
||||||
|
|
||||||
# To work with GPT-4 Turbo:
|
# To work with GPT-4o:
|
||||||
$ aider --openai-api-key sk-xxx... --4turbo
|
$ aider --openai-api-key sk-xxx...
|
||||||
|
|
||||||
# To work with Claude 3 Opus:
|
# To work with Claude 3 Opus:
|
||||||
$ aider --anthropic-api-key sk-xxx... --opus
|
$ aider --anthropic-api-key sk-xxx... --opus
|
||||||
|
@ -51,10 +51,7 @@ $ aider --anthropic-api-key sk-xxx... --opus
|
||||||
|
|
||||||
## Working with other LLMs
|
## Working with other LLMs
|
||||||
|
|
||||||
Aider works well with GPT 3.5, GPT-4, GPT-4 Turbo with Vision,
|
Aider works well with GPT-4o, Claude 3 Opus, GPT-3.5 and supports [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
||||||
and Claude 3 Opus.
|
|
||||||
It also has support for [connecting to almost any LLM](https://aider.chat/docs/llms.html).
|
|
||||||
|
|
||||||
|
|
||||||
## Tutorial videos
|
## Tutorial videos
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
highlight_image: /assets/leaderboard.jpg
|
highlight_image: /assets/leaderboard.jpg
|
||||||
---
|
---
|
||||||
|
|
||||||
# GPT-4o takes #1 & #2 on the Aider LLM leaderboards
|
# Aider LLM Leaderboards
|
||||||
|
|
||||||
Aider works best with LLMs which are good at *editing* code, not just good at writing
|
Aider works best with LLMs which are good at *editing* code, not just good at writing
|
||||||
code.
|
code.
|
||||||
|
@ -14,7 +14,7 @@ The leaderboards below report the results from a number of popular LLMs.
|
||||||
While [aider can connect to almost any LLM](/docs/llms.html),
|
While [aider can connect to almost any LLM](/docs/llms.html),
|
||||||
it works best with models that score well on the benchmarks.
|
it works best with models that score well on the benchmarks.
|
||||||
|
|
||||||
## GPT-4o
|
## GPT-4o takes the #1 & #2 spots
|
||||||
|
|
||||||
GPT-4o tops the aider LLM code editing leaderboard at 72.9%, versus 68.4% for Opus. GPT-4o takes second on aider's refactoring leaderboard with 62.9%, versus Opus at 72.3%.
|
GPT-4o tops the aider LLM code editing leaderboard at 72.9%, versus 68.4% for Opus. GPT-4o takes second on aider's refactoring leaderboard with 62.9%, versus Opus at 72.3%.
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
# Modify an open source 2048 game with aider and gpt-4
|
# Modify an open source 2048 game with aider
|
||||||
|
|
||||||
In this chat transcript, the user explores and modifies an open source [javascript 2048 game repo](https://github.com/gabrielecirulli/2048).
|
In this chat transcript, the user explores and modifies an open source [javascript 2048 game repo](https://github.com/gabrielecirulli/2048).
|
||||||
|
|
||||||
Notice that GPT-4 asks to see a particular source file, and aider automatically includes it in the chat session after getting permission from the user.
|
Notice that the LLM asks to see a particular source file, and aider automatically includes it in the chat session after getting permission from the user.
|
||||||
|
|
||||||
<div class="chat-transcript" markdown="1">
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
@ -18,6 +18,8 @@ Based on the file names you provided, it seems like this repository is for a web
|
||||||
If you need help with any specific part of the code or want to add new features, please let me know, and I'll be happy to assist you.
|
If you need help with any specific part of the code or want to add new features, please let me know, and I'll be happy to assist you.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### how does the scoring work?
|
#### how does the scoring work?
|
||||||
|
|
||||||
To help you with the scoring mechanism, I need to see the relevant code. Please provide the contents of the `js/game_manager.js` file, as it is likely to contain the scoring logic.
|
To help you with the scoring mechanism, I need to see the relevant code. Please provide the contents of the `js/game_manager.js` file, as it is likely to contain the scoring logic.
|
||||||
|
@ -58,6 +60,8 @@ if (next && next.value === tile.value && !next.mergedFrom) {
|
||||||
In this code snippet, when two tiles with the same value (`tile` and `next`) are found, they are merged into a new tile (`merged`). The value of the new tile is added to the current score (`self.score += merged.value`). If the merged tile's value is 2048, the game is considered won (`self.won = true`).
|
In this code snippet, when two tiles with the same value (`tile` and `next`) are found, they are merged into a new tile (`merged`). The value of the new tile is added to the current score (`self.score += merged.value`). If the merged tile's value is 2048, the game is considered won (`self.won = true`).
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can we add some randomness? maybe 10% of the time give the user a 10x bonus?
|
#### can we add some randomness? maybe 10% of the time give the user a 10x bonus?
|
||||||
|
|
||||||
Sure, we can add a 10% chance of giving the user a 10x bonus when two tiles merge. To implement this, we'll modify the scoring logic in the `js/game_manager.js` file. Here's the step-by-step plan:
|
Sure, we can add a 10% chance of giving the user a 10x bonus when two tiles merge. To implement this, we'll modify the scoring logic in the `js/game_manager.js` file. Here's the step-by-step plan:
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
# What's it like to code with GPT-4 and aider?
|
# What's it like to code with aider?
|
||||||
|
|
||||||
Below are some chat transcripts showing what it's like to code with the help of GPT-4 using the `aider` command-line chat tool.
|
Below are some chat transcripts showing what it's like to code with aider.
|
||||||
In the chats, you'll see a varity of coding tasks like generating new code, editing existing code, debugging, exploring unfamiliar code, etc.
|
In the chats, you'll see a varity of coding tasks like generating new code, editing existing code, debugging, exploring unfamiliar code, etc.
|
||||||
|
|
||||||
* [**Hello World Flask App**](https://aider.chat/examples/hello-world-flask.html): Start from scratch and have GPT create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
|
* [**Hello World Flask App**](https://aider.chat/examples/hello-world-flask.html): Start from scratch and have aider create a simple Flask app with various endpoints, such as adding two numbers and calculating the Fibonacci sequence.
|
||||||
|
|
||||||
* [**Javascript Game Modification**](https://aider.chat/examples/2048-game.html): Dive into an existing open-source repo, and get GPT's help to understand it and make modifications.
|
* [**Javascript Game Modification**](https://aider.chat/examples/2048-game.html): Dive into an existing open-source repo, and get aider's help to understand it and make modifications.
|
||||||
|
|
||||||
* [**Complex Multi-file Change with Debugging**](https://aider.chat/examples/complex-change.html): GPT makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
|
* [**Complex Multi-file Change with Debugging**](https://aider.chat/examples/complex-change.html): Aider makes a complex code change that is coordinated across multiple source files, and resolves bugs by reviewing error output and doc snippets.
|
||||||
|
|
||||||
* [**Create a Black Box Test Case**](https://aider.chat/examples/add-test.html): GPT creates a "black box" test case without access to the source of the method being tested, using only a [high level map of the repository based on ctags](https://aider.chat/docs/ctags.html).
|
* [**Create a Black Box Test Case**](https://aider.chat/examples/add-test.html): Aider creates a "black box" test case without access to the source of the method being tested, using only a [high level map of the repository based on ctags](https://aider.chat/docs/ctags.html).
|
||||||
|
|
||||||
* [**Honor the NO_COLOR env var**](https://aider.chat/examples/no-color.html): The user pastes the NO_COLOR spec from no-color.org into the chat, and GPT-4 modifies the application to conform.
|
* [**Honor the NO_COLOR env var**](https://aider.chat/examples/no-color.html): The user pastes the NO_COLOR spec from no-color.org into the chat, and aider modifies the application to conform.
|
||||||
|
|
||||||
* [**Download, analyze and plot US Census data**](https://aider.chat/examples/census.html): GPT-4 downloads census data, suggests some hypotheses to test, tests one and then summarizes and plots a graph of the results.
|
* [**Download, analyze and plot US Census data**](https://aider.chat/examples/census.html): Aider downloads census data, suggests some hypotheses to test, tests one and then summarizes and plots a graph of the results.
|
||||||
|
|
||||||
* [**Semantic Search & Replace**](semantic-search-replace.md): Updating a collection of function calls, which requires dealing with various formatting and semantic differences in the various function call sites.
|
* [**Semantic Search & Replace**](semantic-search-replace.md): Updating a collection of function calls, which requires dealing with various formatting and semantic differences in the various function call sites.
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ In the chats, you'll see a varity of coding tasks like generating new code, edit
|
||||||
|
|
||||||
To better understand the chat transcripts, it's worth knowing that:
|
To better understand the chat transcripts, it's worth knowing that:
|
||||||
|
|
||||||
- Each time GPT-4 suggests a code change, `aider` automatically applies it to the source files.
|
- Each time the LLM suggests a code change, `aider` automatically applies it to the source files.
|
||||||
- After applying the edits, `aider` commits them to git with a descriptive commit message.
|
- After applying the edits, `aider` commits them to git with a descriptive commit message.
|
||||||
- GPT-4 can only see and edit files which have been "added to the chat session". The user adds files either via the command line or the in-chat `/add` command. If GPT-4 asks to see specific files, `aider` asks the user for permission to add them to the chat. The transcripts contain notifications from `aider` whenever a file is added or dropped from the session.
|
- The LLM can only see and edit files which have been "added to the chat session". The user adds files either via the command line or the in-chat `/add` command. If the LLM asks to see specific files, `aider` asks the user for permission to add them to the chat. The transcripts contain notifications from `aider` whenever a file is added or dropped from the session.
|
||||||
|
|
||||||
## Transcript formatting
|
## Transcript formatting
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ To better understand the chat transcripts, it's worth knowing that:
|
||||||
|
|
||||||
#### These are chat messages written by the user.
|
#### These are chat messages written by the user.
|
||||||
|
|
||||||
Chat responses from GPT-4 are in a blue font like this, and often include colorized "edit blocks" that specify edits to the code.
|
Chat responses from the LLM are in a blue font like this, and often include colorized "edit blocks" that specify edits to the code.
|
||||||
Here's a sample edit block that switches from printing "hello" to "goodbye":
|
Here's a sample edit block that switches from printing "hello" to "goodbye":
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
|
|
||||||
# Create a "black box" test case
|
# Create a "black box" test case
|
||||||
|
|
||||||
This transcript shows GPT-4 creating a black box test case,
|
This transcript shows aider creating a black box test case,
|
||||||
**without being given
|
**without being given
|
||||||
access to the source code of the function being tested or any of the
|
access to the source code of the function being tested or any of the
|
||||||
other code in the repo.**
|
other code in the repo.**
|
||||||
|
|
||||||
Instead, GPT is operating entirely off a
|
Instead, aider is operating entirely off a
|
||||||
[high level map of the repository based on ctags](https://aider.chat/docs/ctags.html),
|
[high level map of the repository based on ctags](https://aider.chat/docs/ctags.html),
|
||||||
which provides details on all the symbols and function signatures in the repo.
|
which provides details on all the symbols and function signatures in the repo.
|
||||||
Using only the meta-data in the map, GPT is able to figure out how to call the method to be tested, as well as how to instantiate multiple class objects that are required to prepare for the test.
|
Using only the meta-data in the map, the LLM is able to figure out how to call the method to be tested, as well as how to instantiate multiple class objects that are required to prepare for the test.
|
||||||
|
|
||||||
In detail, GPT is able to use the repo map to:
|
In detail, aider is able to use the repo map to:
|
||||||
|
|
||||||
- Find the function signature of the `cmd_add()` function which the user wants a test case for.
|
- Find the function signature of the `cmd_add()` function which the user wants a test case for.
|
||||||
- Determine that it is a method of the `Command` class, so the test case will need to instantiate an instance to conduct the test.
|
- Determine that it is a method of the `Command` class, so the test case will need to instantiate an instance to conduct the test.
|
||||||
|
@ -19,12 +19,12 @@ In detail, GPT is able to use the repo map to:
|
||||||
- Figure out the arguments required to instantiate the `InputOutput` instance.
|
- Figure out the arguments required to instantiate the `InputOutput` instance.
|
||||||
- Decide that the `Coder` class looks complex enough to use a `MagickMock`.
|
- Decide that the `Coder` class looks complex enough to use a `MagickMock`.
|
||||||
|
|
||||||
The `cmd_add()` method is defined without type annotations, so GPT makes a
|
The `cmd_add()` method is defined without type annotations, so aider makes a
|
||||||
reasonable but incorrect guess that it accepts a `list` of files. The
|
reasonable but incorrect guess that it accepts a `list` of files. The
|
||||||
user invokes the `/run` command to run the new unit test, which throws an
|
user invokes the `/run` command to run the new unit test, which throws an
|
||||||
error based on this misunderstanding.
|
error based on this misunderstanding.
|
||||||
|
|
||||||
GPT reviews the error message and fixes the call to `cmd_add()` to
|
The LLM reviews the error message and fixes the call to `cmd_add()` to
|
||||||
correctly pass a `str` with a space-separated list of filenames
|
correctly pass a `str` with a space-separated list of filenames
|
||||||
instead. The test then passes on the next `/run`.
|
instead. The test then passes on the next `/run`.
|
||||||
|
|
||||||
|
@ -83,6 +83,8 @@ This test will ensure that the `cmd_add` method creates the specified files in t
|
||||||
> Applied edit to tests/test_commands.py
|
> Applied edit to tests/test_commands.py
|
||||||
> Commit e2d5212 aider: Added a test method `test_cmd_add` that creates a temporary directory, calls the `cmd_add` method with 'foo.txt' and 'bar.txt', and checks if both files have been created in the temporary directory.
|
> Commit e2d5212 aider: Added a test method `test_cmd_add` that creates a temporary directory, calls the `cmd_add` method with 'foo.txt' and 'bar.txt', and checks if both files have been created in the temporary directory.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /run pytest tests/test_commands.py
|
#### /run pytest tests/test_commands.py
|
||||||
|
|
||||||
> ```
|
> ```
|
||||||
|
@ -157,6 +159,8 @@ pytest tests/test_commands.py
|
||||||
> Applied edit to tests/test_commands.py
|
> Applied edit to tests/test_commands.py
|
||||||
> Commit d1551b4 aider: Updated test to pass a string instead of a list when calling `cmd_add` method.
|
> Commit d1551b4 aider: Updated test to pass a string instead of a list when calling `cmd_add` method.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /run pytest tests/test_commands.py
|
#### /run pytest tests/test_commands.py
|
||||||
|
|
||||||
> ```
|
> ```
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# Editing an asciinema cast file with aider and gpt-4
|
# Editing an asciinema cast file with aider
|
||||||
|
|
||||||
The user needs to make some tedious edits to the escape sequences in an `asciinema` screencast file.
|
The user needs to make some tedious edits to the escape sequences in an `asciinema` screencast file.
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
Inspired by
|
Inspired by
|
||||||
[Ethan Mollick's recent blog article about ChatGPT plugins](https://www.oneusefulthing.org/p/it-is-starting-to-get-strange),
|
[Ethan Mollick's recent blog article about ChatGPT plugins](https://www.oneusefulthing.org/p/it-is-starting-to-get-strange),
|
||||||
I used `aider` and GPT-4 to do data analysis of some US Census data.
|
I used `aider` and GPT-4 to do data analysis of some US Census data.
|
||||||
I asked GPT-4 how to download census data and to suggest some
|
I asked aider how to download census data and to suggest some
|
||||||
hypotheses to test. I asked it to write the code to get the data, test one of the
|
hypotheses to test. I asked it to write the code to get the data, test one of the
|
||||||
hypotheses and provide a summary and plot of the results.
|
hypotheses and provide a summary and plot of the results.
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ Some interesting patterns to analyze in the ACS dataset could include:
|
||||||
Remember to consider the dataset's documentation and guidelines to understand the data and its limitations.
|
Remember to consider the dataset's documentation and guidelines to understand the data and its limitations.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### do you know how to download American Community Survey data?
|
#### do you know how to download American Community Survey data?
|
||||||
|
|
||||||
Yes, I can guide you on how to download American Community Survey (ACS) data. You can use the Census Bureau's API to access the data. To do this, you'll need an API key, which you can obtain from the Census Bureau's website.
|
Yes, I can guide you on how to download American Community Survey (ACS) data. You can use the Census Bureau's API to access the data. To do this, you'll need an API key, which you can obtain from the Census Bureau's website.
|
||||||
|
@ -75,6 +77,8 @@ For more information on available variables and geographic areas, refer to the A
|
||||||
- Geographic Areas: https://api.census.gov/data/2019/acs/acs5/geography.html
|
- Geographic Areas: https://api.census.gov/data/2019/acs/acs5/geography.html
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### how do i get an api key?
|
#### how do i get an api key?
|
||||||
|
|
||||||
To obtain an API key from the Census Bureau, follow these steps:
|
To obtain an API key from the Census Bureau, follow these steps:
|
||||||
|
@ -90,6 +94,8 @@ To obtain an API key from the Census Bureau, follow these steps:
|
||||||
Once you have your API key, you can use it in your Python code to access the American Community Survey data, as shown in the previous example. Replace `'your_api_key'` with the API key you received in the email.
|
Once you have your API key, you can use it in your Python code to access the American Community Survey data, as shown in the previous example. Replace `'your_api_key'` with the API key you received in the email.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### please save your download script as `getdata.py`
|
#### please save your download script as `getdata.py`
|
||||||
|
|
||||||
Here's the `getdata.py` file with the download script:
|
Here's the `getdata.py` file with the download script:
|
||||||
|
@ -128,6 +134,8 @@ Save this code in a new file named `getdata.py`. Remember to replace `'your_api_
|
||||||
> Applied edit to new_file/getdata.py
|
> Applied edit to new_file/getdata.py
|
||||||
> Commit afcb9d1 aider: Added `getdata.py` file with download script.
|
> Commit afcb9d1 aider: Added `getdata.py` file with download script.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add my api key: 4ae31ed2a0f0dd62609e51cd95deadbeefe7774f
|
#### add my api key: 4ae31ed2a0f0dd62609e51cd95deadbeefe7774f
|
||||||
|
|
||||||
I will update the API key in the file.
|
I will update the API key in the file.
|
||||||
|
@ -145,6 +153,8 @@ api_key = '4ae31ed2a0f0dd62609e51cd95deadbeefe7774f'
|
||||||
> Commit 1d8b4a6 aider: Updated the API key in new_file/getdata.py.
|
> Commit 1d8b4a6 aider: Updated the API key in new_file/getdata.py.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### what are some interesting hypothesis that you might be able to test using ACS data?
|
#### what are some interesting hypothesis that you might be able to test using ACS data?
|
||||||
|
|
||||||
Here are some interesting hypotheses that you can test using ACS (American Community Survey) data:
|
Here are some interesting hypotheses that you can test using ACS (American Community Survey) data:
|
||||||
|
@ -158,6 +168,8 @@ Here are some interesting hypotheses that you can test using ACS (American Commu
|
||||||
These are just a few examples. ACS data provides a wealth of information on various demographic, social, economic, and housing characteristics, allowing you to explore many different hypotheses.
|
These are just a few examples. ACS data provides a wealth of information on various demographic, social, economic, and housing characteristics, allowing you to explore many different hypotheses.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can you download the data to test #2 Impact of population density on housing prices: Higher population density areas have higher housing prices.
|
#### can you download the data to test #2 Impact of population density on housing prices: Higher population density areas have higher housing prices.
|
||||||
|
|
||||||
As an AI language model, I cannot directly download or access data. However, I can help you with the code to download the required data for testing hypothesis #2 using the ACS data.
|
As an AI language model, I cannot directly download or access data. However, I can help you with the code to download the required data for testing hypothesis #2 using the ACS data.
|
||||||
|
@ -183,6 +195,8 @@ After running the updated code, you'll have the population and housing price dat
|
||||||
> Applied edit to new_file/getdata.py
|
> Applied edit to new_file/getdata.py
|
||||||
> Commit 81549ab aider: Updated code to fetch population and housing price data for testing hypothesis #2.
|
> Commit 81549ab aider: Updated code to fetch population and housing price data for testing hypothesis #2.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### instead of printing all the data, print a summary table that shows whether the data supports the hypothesis
|
#### instead of printing all the data, print a summary table that shows whether the data supports the hypothesis
|
||||||
|
|
||||||
To print a summary table, you can use the pandas library to analyze the data and calculate the correlation between population density and housing prices. Here's how to modify the code:
|
To print a summary table, you can use the pandas library to analyze the data and calculate the correlation between population density and housing prices. Here's how to modify the code:
|
||||||
|
@ -239,6 +253,8 @@ After applying these changes, the code will print a summary table showing the co
|
||||||
> Commit 2f4fcd4 aider: Added pandas library to analyze data and calculate correlation between population density and housing prices, and printed the correlation as a summary table.
|
> Commit 2f4fcd4 aider: Added pandas library to analyze data and calculate correlation between population density and housing prices, and printed the correlation as a summary table.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /run python3 new_file/getdata.py
|
#### /run python3 new_file/getdata.py
|
||||||
>```
|
>```
|
||||||
>Summary Table:
|
>Summary Table:
|
||||||
|
@ -250,6 +266,8 @@ After applying these changes, the code will print a summary table showing the co
|
||||||
Great! The script seems to be working as expected. The correlation between population density and housing prices is 0.1602. If you need any further assistance or modifications to the code, please let me know.
|
Great! The script seems to be working as expected. The correlation between population density and housing prices is 0.1602. If you need any further assistance or modifications to the code, please let me know.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can you also plot a graph which would show any correlation?
|
#### can you also plot a graph which would show any correlation?
|
||||||
|
|
||||||
To plot a graph showing the correlation between population density and housing prices, we'll need to modify the `new_file/getdata.py` file. We'll use the `matplotlib` library to create the plot. If you don't have it installed, you can install it using `pip install matplotlib`.
|
To plot a graph showing the correlation between population density and housing prices, we'll need to modify the `new_file/getdata.py` file. We'll use the `matplotlib` library to create the plot. If you don't have it installed, you can install it using `pip install matplotlib`.
|
||||||
|
|
|
@ -24,6 +24,8 @@ assets/css/style.css
|
||||||
> ^C again to quit
|
> ^C again to quit
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### make all the edits to the embedded style tag in the html
|
#### make all the edits to the embedded style tag in the html
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -63,12 +65,9 @@ index.html
|
||||||
> Commit e7a5cb5 aider: Added rounded border to all sides of the boxquote.
|
> Commit e7a5cb5 aider: Added rounded border to all sides of the boxquote.
|
||||||
|
|
||||||
|
|
||||||
#### (blank)
|
|
||||||
> Git repo has uncommitted changes.
|
|
||||||
> Commit before the chat proceeds [y/n/commit message]? Changed border color and width of blockquote in index.html.
|
|
||||||
> Commit 6898a1d Changed border color and width of blockquote in index.html.
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### make the blockquote font color the same as the p color
|
#### make the blockquote font color the same as the p color
|
||||||
> Git repo has uncommitted changes.
|
> Git repo has uncommitted changes.
|
||||||
> Commit before the chat proceeds [y/n/commit message]? Added note about missing method and incorrect method calls in index.html.
|
> Commit before the chat proceeds [y/n/commit message]? Added note about missing method and incorrect method calls in index.html.
|
||||||
|
@ -123,12 +122,8 @@ index.html
|
||||||
> Commit 8645217 aider: Changed blockquote font color to match <p> color in index.html.
|
> Commit 8645217 aider: Changed blockquote font color to match <p> color in index.html.
|
||||||
|
|
||||||
|
|
||||||
#### (blank)
|
</div>
|
||||||
> Git repo has uncommitted changes.
|
<div class="chat-transcript" markdown="1">
|
||||||
> Commit before the chat proceeds [y/n/commit message]? Removed color and button styles from blockquote in index.html.
|
|
||||||
> Commit f8d4782 Removed color and button styles from blockquote in index.html.
|
|
||||||
|
|
||||||
|
|
||||||
#### make the blockquote background a lighter shade of the same green as the border
|
#### make the blockquote background a lighter shade of the same green as the border
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -153,6 +148,8 @@ index.html
|
||||||
> Commit 57b7b10 aider: Changed blockquote background color to a lighter shade of green.
|
> Commit 57b7b10 aider: Changed blockquote background color to a lighter shade of green.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add some space inside the border of the blockquote
|
#### add some space inside the border of the blockquote
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -179,6 +176,8 @@ index.html
|
||||||
> Commit dd7dcb6 aider: Added padding inside the border of the blockquote.
|
> Commit dd7dcb6 aider: Added padding inside the border of the blockquote.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can we add a label "aider" along the top of the blockquote box only using style
|
#### can we add a label "aider" along the top of the blockquote box only using style
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -220,6 +219,8 @@ index.html
|
||||||
> Commit 0b0e332 aider: Added label "aider" to the top of the blockquote box using style.
|
> Commit 0b0e332 aider: Added label "aider" to the top of the blockquote box using style.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add more padding on the top of the box and bring the label into the box so it doesn't intersect the border
|
#### add more padding on the top of the box and bring the label into the box so it doesn't intersect the border
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -273,12 +274,8 @@ index.html
|
||||||
> Commit eee902e aider: Added more padding on the top of the box and brought the label into the box so it doesn't intersect the border.
|
> Commit eee902e aider: Added more padding on the top of the box and brought the label into the box so it doesn't intersect the border.
|
||||||
|
|
||||||
|
|
||||||
#### (blank)
|
</div>
|
||||||
> Git repo has uncommitted changes.
|
<div class="chat-transcript" markdown="1">
|
||||||
> Commit before the chat proceeds [y/n/commit message]? Changed padding and added margin to main-content blockquote.
|
|
||||||
> Commit c9128d1 Changed padding and added margin to main-content blockquote.
|
|
||||||
|
|
||||||
|
|
||||||
#### change all the blockquote colors to be shades of blue instead of green. choose the blue based on the blue in the header gradient
|
#### change all the blockquote colors to be shades of blue instead of green. choose the blue based on the blue in the header gradient
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -331,6 +328,8 @@ index.html
|
||||||
> Applied edit to index.html
|
> Applied edit to index.html
|
||||||
> Commit a26c135 aider: Changed blockquote colors to shades of blue based on the blue in the header gradient.
|
> Commit a26c135 aider: Changed blockquote colors to shades of blue based on the blue in the header gradient.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can you style the "aider" label on the blockquote as a "tab" that docks onto the top of the box?
|
#### can you style the "aider" label on the blockquote as a "tab" that docks onto the top of the box?
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
@ -385,12 +384,8 @@ index.html
|
||||||
> Commit 292eda3 aider: Styled the "aider" label on the blockquote as a "tab" that docks onto the top of the box.
|
> Commit 292eda3 aider: Styled the "aider" label on the blockquote as a "tab" that docks onto the top of the box.
|
||||||
|
|
||||||
|
|
||||||
#### (blank)
|
</div>
|
||||||
> Git repo has uncommitted changes.
|
<div class="chat-transcript" markdown="1">
|
||||||
> Commit before the chat proceeds [y/n/commit message]? Changed padding and positioning of a CSS element and updated its border.
|
|
||||||
> Commit 01fda51 Changed padding and positioning of a CSS element and updated its border.
|
|
||||||
|
|
||||||
|
|
||||||
#### apply the same box around the h4 element
|
#### apply the same box around the h4 element
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
|
|
@ -6,7 +6,7 @@ This is a chat transcript of a fairly complex code change. The user is trying to
|
||||||
Some things to notice:
|
Some things to notice:
|
||||||
- The initial changes don't work, so the user provides error messages and snippets from the `prompt_toolkit` docs to collaboratively debug and solve the problem.
|
- The initial changes don't work, so the user provides error messages and snippets from the `prompt_toolkit` docs to collaboratively debug and solve the problem.
|
||||||
- The user edits a file outside the chat using their editor. `aider` notices these out-of-band changes and offers to commit them.
|
- The user edits a file outside the chat using their editor. `aider` notices these out-of-band changes and offers to commit them.
|
||||||
- At one point the user hits `^C` to interrupt the GPT-4 response, since it's not a useful response. The user gives clarifications and gets a better result on the next reply.
|
- At one point the user hits `^C` to interrupt the LLM response, since it's not a useful response. The user gives clarifications and gets a better result on the next reply.
|
||||||
|
|
||||||
<div class="chat-transcript" markdown="1">
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
@ -114,6 +114,8 @@ These changes will replace the usage of `/dev/null` with `prompt_toolkit`'s inpu
|
||||||
> Commit 6724fcd Added import statement for sys module in test_main.py.
|
> Commit 6724fcd Added import statement for sys module in test_main.py.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /add aider/main.py
|
#### /add aider/main.py
|
||||||
|
|
||||||
> Added aider/main.py to the chat
|
> Added aider/main.py to the chat
|
||||||
|
@ -145,6 +147,8 @@ Now, the `main()` function will accept the `input` and `output` keyword argument
|
||||||
> Applied edit to aider/main.py
|
> Applied edit to aider/main.py
|
||||||
> Commit 79dfba9 aider: Fixed main() function to accept input and output keyword arguments.
|
> Commit 79dfba9 aider: Fixed main() function to accept input and output keyword arguments.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### we need to pass those into InputOutput and to prompt_toolkit right?
|
#### we need to pass those into InputOutput and to prompt_toolkit right?
|
||||||
|
|
||||||
Yes, you're right. We need to pass the `input` and `output` arguments to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function. Here's how to modify the `aider/getinput.py` and `aider/main.py` files:
|
Yes, you're right. We need to pass the `input` and `output` arguments to the `InputOutput` class and then to the `prompt_toolkit.prompt()` function. Here's how to modify the `aider/getinput.py` and `aider/main.py` files:
|
||||||
|
@ -209,6 +213,8 @@ These changes will ensure that the `input` and `output` arguments are passed to
|
||||||
> Applied edit to aider/main.py
|
> Applied edit to aider/main.py
|
||||||
> Commit cea9d2a aider: Updated InputOutput class to accept input and output arguments and passed them to prompt_toolkit.prompt() function.
|
> Commit cea9d2a aider: Updated InputOutput class to accept input and output arguments and passed them to prompt_toolkit.prompt() function.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### FAILED tests/test_main.py::TestMain::test_main_with_empty_git_dir_new_file - TypeError: prompt() got an unexpected keyword argument 'input'
|
#### FAILED tests/test_main.py::TestMain::test_main_with_empty_git_dir_new_file - TypeError: prompt() got an unexpected keyword argument 'input'
|
||||||
|
|
||||||
I apologize for the confusion. It seems I made a mistake in the `prompt_toolkit.prompt()` function call. The `prompt()` function accepts `stdin` and `stdout` arguments instead of `input` and `output`. Here's the fix:
|
I apologize for the confusion. It seems I made a mistake in the `prompt_toolkit.prompt()` function call. The `prompt()` function accepts `stdin` and `stdout` arguments instead of `input` and `output`. Here's the fix:
|
||||||
|
@ -231,6 +237,8 @@ These changes will ensure that the `input` and `output` arguments are passed cor
|
||||||
> Applied edit to aider/getinput.py
|
> Applied edit to aider/getinput.py
|
||||||
> Commit 55d3540 aider: Fixed `prompt()` function call in `get_input()` method to pass `stdin` and `stdout` arguments instead of `input` and `output`.
|
> Commit 55d3540 aider: Fixed `prompt()` function call in `get_input()` method to pass `stdin` and `stdout` arguments instead of `input` and `output`.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### prompt_toolkit.shortcuts.prompt(message: AnyFormattedText | None = None, *, history: History | None = None, editing_mode: EditingMode | None = None, refresh_interval: float | None = None, vi_mode: bool | None = None, lexer: Lexer | None = None, completer: Completer | None = None, complete_in_thread: bool | None = None, is_password: bool | None = None, key_bindings: KeyBindingsBase | None = None, bottom_toolbar: AnyFormattedText | None = None, style: BaseStyle | None = None, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool | None = None, rprompt: AnyFormattedText | None = None, multiline: FilterOrBool | None = None, prompt_continuation: PromptContinuationText | None = None, wrap_lines: FilterOrBool | None = None, enable_history_search: FilterOrBool | None = None, search_ignore_case: FilterOrBool | None = None, complete_while_typing: FilterOrBool | None = None, validate_while_typing: FilterOrBool | None = None, complete_style: CompleteStyle | None = None, auto_suggest: AutoSuggest | None = None, validator: Validator | None = None, clipboard: Clipboard | None = None, mouse_support: FilterOrBool | None = None, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, reserve_space_for_menu: int | None = None, enable_system_prompt: FilterOrBool | None = None, enable_suspend: FilterOrBool | None = None, enable_open_in_editor: FilterOrBool | None = None, tempfile_suffix: str | Callable[[], str] | None = None, tempfile: str | Callable[[], str] | None = None, default: str = '', accept_default: bool = False, pre_run: Callable[[], None] | None = None) → str
|
#### prompt_toolkit.shortcuts.prompt(message: AnyFormattedText | None = None, *, history: History | None = None, editing_mode: EditingMode | None = None, refresh_interval: float | None = None, vi_mode: bool | None = None, lexer: Lexer | None = None, completer: Completer | None = None, complete_in_thread: bool | None = None, is_password: bool | None = None, key_bindings: KeyBindingsBase | None = None, bottom_toolbar: AnyFormattedText | None = None, style: BaseStyle | None = None, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool | None = None, rprompt: AnyFormattedText | None = None, multiline: FilterOrBool | None = None, prompt_continuation: PromptContinuationText | None = None, wrap_lines: FilterOrBool | None = None, enable_history_search: FilterOrBool | None = None, search_ignore_case: FilterOrBool | None = None, complete_while_typing: FilterOrBool | None = None, validate_while_typing: FilterOrBool | None = None, complete_style: CompleteStyle | None = None, auto_suggest: AutoSuggest | None = None, validator: Validator | None = None, clipboard: Clipboard | None = None, mouse_support: FilterOrBool | None = None, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, reserve_space_for_menu: int | None = None, enable_system_prompt: FilterOrBool | None = None, enable_suspend: FilterOrBool | None = None, enable_open_in_editor: FilterOrBool | None = None, tempfile_suffix: str | Callable[[], str] | None = None, tempfile: str | Callable[[], str] | None = None, default: str = '', accept_default: bool = False, pre_run: Callable[[], None] | None = None) → str
|
||||||
|
|
||||||
I apologize for the confusion earlier. It seems that the `prompt_toolkit.prompt()` function does not accept `stdin` and `stdout` arguments directly. Instead, we need to use the `Application` class from `prompt_toolkit` to create a custom application with the desired input and output. Here's how to modify the `aider/getinput.py` file:
|
I apologize for the confusion earlier. It seems that the `prompt_toolkit.prompt()` function does not accept `stdin` and `stdout` arguments directly. Instead, we need to use the `Application` class from `prompt_toolkit` to create a custom application with the desired input and output. Here's how to modify the `aider/getinput.py` file:
|
||||||
|
@ -239,6 +247,8 @@ First, import the necessary classes and functions from `prompt_tool
|
||||||
|
|
||||||
> ^C KeyboardInterrupt
|
> ^C KeyboardInterrupt
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### class prompt_toolkit.shortcuts.PromptSession(message: AnyFormattedText = '', *, multiline: FilterOrBool = False, wrap_lines: FilterOrBool = True, is_password: FilterOrBool = False, vi_mode: bool = False, editing_mode: EditingMode = <EditingMode.EMACS: 'EMACS'>, complete_while_typing: FilterOrBool = True, validate_while_typing: FilterOrBool = True, enable_history_search: FilterOrBool = False, search_ignore_case: FilterOrBool = False, lexer: Lexer | None = None, enable_system_prompt: FilterOrBool = False, enable_suspend: FilterOrBool = False, enable_open_in_editor: FilterOrBool = False, validator: Validator | None = None, completer: Completer | None = None, complete_in_thread: bool = False, reserve_space_for_menu: int = 8, complete_style: CompleteStyle = <CompleteStyle.COLUMN: 'COLUMN'>, auto_suggest: AutoSuggest | None = None, style: BaseStyle | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool = False, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool = True, history: History | None = None, clipboard: Clipboard | None = None, prompt_continuation: PromptContinuationText | None = None, rprompt: AnyFormattedText = None, bottom_toolbar: AnyFormattedText = None, mouse_support: FilterOrBool = False, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, key_bindings: KeyBindingsBase | None = None, erase_when_done: bool = False, tempfile_suffix: str | Callable[[], str] | None = '.txt', tempfile: str | Callable[[], str] | None = None, refresh_interval: float = 0, input: Input | None = None, output: Output | None = None)
|
#### class prompt_toolkit.shortcuts.PromptSession(message: AnyFormattedText = '', *, multiline: FilterOrBool = False, wrap_lines: FilterOrBool = True, is_password: FilterOrBool = False, vi_mode: bool = False, editing_mode: EditingMode = <EditingMode.EMACS: 'EMACS'>, complete_while_typing: FilterOrBool = True, validate_while_typing: FilterOrBool = True, enable_history_search: FilterOrBool = False, search_ignore_case: FilterOrBool = False, lexer: Lexer | None = None, enable_system_prompt: FilterOrBool = False, enable_suspend: FilterOrBool = False, enable_open_in_editor: FilterOrBool = False, validator: Validator | None = None, completer: Completer | None = None, complete_in_thread: bool = False, reserve_space_for_menu: int = 8, complete_style: CompleteStyle = <CompleteStyle.COLUMN: 'COLUMN'>, auto_suggest: AutoSuggest | None = None, style: BaseStyle | None = None, style_transformation: StyleTransformation | None = None, swap_light_and_dark_colors: FilterOrBool = False, color_depth: ColorDepth | None = None, cursor: AnyCursorShapeConfig = None, include_default_pygments_style: FilterOrBool = True, history: History | None = None, clipboard: Clipboard | None = None, prompt_continuation: PromptContinuationText | None = None, rprompt: AnyFormattedText = None, bottom_toolbar: AnyFormattedText = None, mouse_support: FilterOrBool = False, input_processors: list[Processor] | None = None, placeholder: AnyFormattedText | None = None, key_bindings: KeyBindingsBase | None = None, erase_when_done: bool = False, tempfile_suffix: str | Callable[[], str] | None = '.txt', tempfile: str | Callable[[], str] | None = None, refresh_interval: float = 0, input: Input | None = None, output: Output | None = None)
|
||||||
|
|
||||||
Thank you for providing the `PromptSession` class information. We can use the `PromptSession` class to create a custom session with the desired input and output. Here's how to modify the `aider/getinput.py` file:
|
Thank you for providing the `PromptSession` class information. We can use the `PromptSession` class to create a custom session with the desired input and output. Here's how to modify the `aider/getinput.py` file:
|
||||||
|
@ -290,6 +300,8 @@ These changes will ensure that the `input` and `output` arguments are passed cor
|
||||||
> Applied edit to aider/getinput.py
|
> Applied edit to aider/getinput.py
|
||||||
> Commit ac92cca aider: Replaced `prompt()` with `PromptSession()` to correctly pass input and output arguments.
|
> Commit ac92cca aider: Replaced `prompt()` with `PromptSession()` to correctly pass input and output arguments.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### try using create_input(StringIO('')) in the tests
|
#### try using create_input(StringIO('')) in the tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,6 +357,8 @@ These changes will replace the usage of `create_pipe_input()` with `create_input
|
||||||
> Applied edit to tests/test_main.py
|
> Applied edit to tests/test_main.py
|
||||||
> Commit 4bb043f aider: Replaced the usage of `create_pipe_input()` with `create_input(StringIO(''))` in the test cases.
|
> Commit 4bb043f aider: Replaced the usage of `create_pipe_input()` with `create_input(StringIO(''))` in the test cases.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### nice, that worked!
|
#### nice, that worked!
|
||||||
|
|
||||||
I'm glad the changes worked for you! If you have any more requests or need further assistance, feel free to ask.
|
I'm glad the changes worked for you! If you have any more requests or need further assistance, feel free to ask.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# Complete a css exercise with aider and GPT-4
|
# Complete a css exercise with aider
|
||||||
|
|
||||||
In this chat transcript, the user asks about the open source [CSS Exercises repo](https://github.com/TheOdinProject/css-exercises) and completes an animation exercise.
|
In this chat transcript, the user asks about the open source [CSS Exercises repo](https://github.com/TheOdinProject/css-exercises) and completes an animation exercise.
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ In this chat transcript, the user asks about the open source [CSS Exercises repo
|
||||||
Based on the file list provided, it seems like this repository contains a collection of CSS and HTML exercises, solutions, and examples. The exercises cover various topics such as Flexbox, Grid, Animation, Foundations, and Margin & Padding. The repository also includes images and other assets used in the exercises.
|
Based on the file list provided, it seems like this repository contains a collection of CSS and HTML exercises, solutions, and examples. The exercises cover various topics such as Flexbox, Grid, Animation, Foundations, and Margin & Padding. The repository also includes images and other assets used in the exercises.
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /add animation/03-dropdown-menu/README.md
|
#### /add animation/03-dropdown-menu/README.md
|
||||||
|
|
||||||
> Added animation/03-dropdown-menu/README.md to the chat
|
> Added animation/03-dropdown-menu/README.md to the chat
|
||||||
|
@ -21,6 +23,8 @@ Yes, I see the content of the `animation/03-dropdown-menu/README.md` file. It de
|
||||||
Is there any specific change or improvement you would like me to make to this file or any other file in the repository?
|
Is there any specific change or improvement you would like me to make to this file or any other file in the repository?
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can you make the changes suggested in the readme?
|
#### can you make the changes suggested in the readme?
|
||||||
|
|
||||||
To make the changes suggested in the `animation/03-dropdown-menu/README.md`, I need to see the contents of the following files:
|
To make the changes suggested in the `animation/03-dropdown-menu/README.md`, I need to see the contents of the following files:
|
||||||
|
@ -70,6 +74,8 @@ These changes add the bounce animation to the dropdown menu by creating a new ke
|
||||||
> Applied edit to animation/03-dropdown-menu/style.css
|
> Applied edit to animation/03-dropdown-menu/style.css
|
||||||
> Commit bb3a813 aider: Added bounce animation to dropdown menu.
|
> Commit bb3a813 aider: Added bounce animation to dropdown menu.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### that worked!
|
#### that worked!
|
||||||
|
|
||||||
I'm glad the changes worked for you! If you have any more requests or need assistance with other parts of the code, feel free to ask. I'm here to help!
|
I'm glad the changes worked for you! If you have any more requests or need assistance with other parts of the code, feel free to ask. I'm here to help!
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# Create a simple flask app with aider & gpt-4
|
# Create a simple flask app with aider
|
||||||
|
|
||||||
In this chat transcript, the user asks to make a simple flask app with various endpoints.
|
In this chat transcript, the user asks to make a simple flask app with various endpoints.
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ Make sure to install Flask in your project environment using `pip install flask`
|
||||||
> Applied edit to app.py
|
> Applied edit to app.py
|
||||||
> Commit 414c394 aider: Added a `/hello` endpoint that returns "Hello, World!" to the Flask app.
|
> Commit 414c394 aider: Added a `/hello` endpoint that returns "Hello, World!" to the Flask app.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add an endpoint like /add/3/5 which returns the sum of the 2 numbers
|
#### add an endpoint like /add/3/5 which returns the sum of the 2 numbers
|
||||||
|
|
||||||
To add an endpoint like `/add/3/5` that returns the sum of the two numbers, you can create a new route with two URL parameters. Update the `app.py` file as follows:
|
To add an endpoint like `/add/3/5` that returns the sum of the two numbers, you can create a new route with two URL parameters. Update the `app.py` file as follows:
|
||||||
|
@ -62,6 +64,8 @@ Now, when you visit `/add/3/5`, it will return the sum of the two numbers, which
|
||||||
> Applied edit to app.py
|
> Applied edit to app.py
|
||||||
> Commit 0872c51 aider: Added an endpoint `/add/<int:num1>/<int:num2>` that returns the sum of the two numbers.
|
> Commit 0872c51 aider: Added an endpoint `/add/<int:num1>/<int:num2>` that returns the sum of the two numbers.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add /fibonacci/X
|
#### add /fibonacci/X
|
||||||
|
|
||||||
To add a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence, you can create a new route with a URL parameter for X and a function to calculate the Fibonacci number. Update the `app.py` file as follows:
|
To add a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence, you can create a new route with a URL parameter for X and a function to calculate the Fibonacci number. Update the `app.py` file as follows:
|
||||||
|
@ -101,6 +105,8 @@ Now, when you visit `/fibonacci/X`, it will return the Xth number in the Fibonac
|
||||||
> Applied edit to app.py
|
> Applied edit to app.py
|
||||||
> Commit 163fba8 aider: Added a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence.
|
> Commit 163fba8 aider: Added a `/fibonacci/X` endpoint that returns the Xth number in the Fibonacci sequence.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### remove the hello endpoint
|
#### remove the hello endpoint
|
||||||
|
|
||||||
To remove the `/hello` endpoint, you can simply delete the corresponding route and function in the `app.py` file. Here's the update:
|
To remove the `/hello` endpoint, you can simply delete the corresponding route and function in the `app.py` file. Here's the update:
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
# Honor the NO_COLOR environment variable
|
# Honor the NO_COLOR environment variable
|
||||||
|
|
||||||
The user pastes the specification of the NO_COLOR environment variable protocol
|
The user pastes the specification of the NO_COLOR environment variable protocol
|
||||||
from [no-color.org](https://no-color.org) into the chat with GPT-4.
|
from [no-color.org](https://no-color.org) into the aider chat.
|
||||||
|
|
||||||
GPT figures out which files need to be edited, and asks permission to make changes.
|
Aider figures out which files need to be edited, and asks permission to make changes.
|
||||||
It then disables all the color and pretty-printing functions if NO_COLOR is
|
It then disables all the color and pretty-printing functions if NO_COLOR is
|
||||||
set, so the tool conforms to the specification.
|
set, so the tool conforms to the specification.
|
||||||
|
|
||||||
The user then asks for a test case, which GPT adds as well.
|
The user then asks for a test case, which aider adds as well.
|
||||||
|
|
||||||
<div class="chat-transcript" markdown="1">
|
<div class="chat-transcript" markdown="1">
|
||||||
|
|
||||||
|
@ -107,6 +107,8 @@ These changes will make the software check for the `NO_COLOR` environment variab
|
||||||
> Applied edit to aider/io.py
|
> Applied edit to aider/io.py
|
||||||
> Commit 3218242 aider: Added check for NO_COLOR environment variable to disable ANSI color.
|
> Commit 3218242 aider: Added check for NO_COLOR environment variable to disable ANSI color.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### add a test
|
#### add a test
|
||||||
|
|
||||||
To add a test for the `NO_COLOR` environment variable, we will create a new test function in the `tests/test_io.py` file. Since this file does not exist, we will create it first.
|
To add a test for the `NO_COLOR` environment variable, we will create a new test function in the `tests/test_io.py` file. Since this file does not exist, we will create it first.
|
||||||
|
@ -138,6 +140,8 @@ This test function checks if the `pretty` attribute of the `InputOutput` class i
|
||||||
> Applied edit to tests/test_io.py
|
> Applied edit to tests/test_io.py
|
||||||
> Commit 52a9df5 aider: Added a test function to check if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
|
> Commit 52a9df5 aider: Added a test function to check if the `pretty` attribute of the `InputOutput` class is set to `False` when the `NO_COLOR` environment variable is set.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### /run pytest
|
#### /run pytest
|
||||||
|
|
||||||
> ============================= test session starts ==============================
|
> ============================= test session starts ==============================
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
# Build pong with aider, gpt-4 and pygame.
|
# Build pong with aider and pygame.
|
||||||
|
|
||||||
In this chat transcript, the user asks to make a pong game using pygame.
|
In this chat transcript, the user asks to make a pong game using pygame.
|
||||||
After setting up a basic game, the user asks for some customization of the colors and game mechanics.
|
After setting up a basic game, the user asks for some customization of the colors and game mechanics.
|
||||||
|
@ -68,6 +68,8 @@ This is the basic structure of the game. Now, let's add the Paddle and Ball clas
|
||||||
> Applied edit to pong_game.py
|
> Applied edit to pong_game.py
|
||||||
> Commit 14799cb aider: Added basic Pygame initialization and game loop structure to `pong_game.py`.
|
> Commit 14799cb aider: Added basic Pygame initialization and game loop structure to `pong_game.py`.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### go ahead
|
#### go ahead
|
||||||
|
|
||||||
Now, let's add the Paddle and Ball classes, handle user input, update the ball position, draw the objects, and handle scoring. I'll provide the code changes in an *EDIT BLOCK*.
|
Now, let's add the Paddle and Ball classes, handle user input, update the ball position, draw the objects, and handle scoring. I'll provide the code changes in an *EDIT BLOCK*.
|
||||||
|
@ -218,6 +220,8 @@ Now, you should have a simple Pong game using Pygame. You can further improve th
|
||||||
> Applied edit to pong_game.py
|
> Applied edit to pong_game.py
|
||||||
> Commit b20bcee aider: Added Paddle and Ball classes, handled user input, updated ball position, drew objects, and handled scoring.
|
> Commit b20bcee aider: Added Paddle and Ball classes, handled user input, updated ball position, drew objects, and handled scoring.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### nice, it works. but the ball moves way too fast.
|
#### nice, it works. but the ball moves way too fast.
|
||||||
|
|
||||||
I'm glad it works! Let's slow down the ball by reducing its speed. We can do this by changing the values of `self.dx` and `self.dy` in the `Ball` class.
|
I'm glad it works! Let's slow down the ball by reducing its speed. We can do this by changing the values of `self.dx` and `self.dy` in the `Ball` class.
|
||||||
|
@ -238,6 +242,8 @@ This change will reduce the ball's speed by half. You can adjust the values furt
|
||||||
> Applied edit to pong_game.py
|
> Applied edit to pong_game.py
|
||||||
> Commit f4ceed4 aider: Reduced ball speed by half.
|
> Commit f4ceed4 aider: Reduced ball speed by half.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### can you make the paddles a bit bigger? and make one paddle red and one blue?
|
#### can you make the paddles a bit bigger? and make one paddle red and one blue?
|
||||||
|
|
||||||
Sure, let's make the paddles bigger and change their colors. We can do this by modifying the `Paddle` class in the `pong_game.py` file.
|
Sure, let's make the paddles bigger and change their colors. We can do this by modifying the `Paddle` class in the `pong_game.py` file.
|
||||||
|
@ -277,6 +283,8 @@ With these changes, the paddles will be larger, and the left paddle will be red
|
||||||
> Applied edit to pong_game.py
|
> Applied edit to pong_game.py
|
||||||
> Commit 2c645c9 aider: Changed paddle size and color, and set left paddle to red.
|
> Commit 2c645c9 aider: Changed paddle size and color, and set left paddle to red.
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="chat-transcript" markdown="1">
|
||||||
#### each time the ball bounces off the paddle, can you make it go 10% faster?
|
#### each time the ball bounces off the paddle, can you make it go 10% faster?
|
||||||
|
|
||||||
Sure, let's increase the ball's speed by 10% each time it bounces off a paddle. We can do this by modifying the `collide_with` method in the `Ball` class.
|
Sure, let's increase the ball's speed by 10% each time it bounces off a paddle. We can do this by modifying the `collide_with` method in the `Ball` class.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Semantic search & replace code with aider and gpt-4
|
# Semantic search & replace code with aider
|
||||||
|
|
||||||
In this chat transcript, the user asks to modify a series of function calls.
|
In this chat transcript, the user asks to modify a series of function calls.
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Automatically update docs with aider and gpt-4
|
# Automatically update docs with aider
|
||||||
|
|
||||||
In this chat transcript, the user asks to automatically update the Usage docs based on the latest version of the main() function in the code.
|
In this chat transcript, the user asks to automatically update the Usage docs based on the latest version of the main() function in the code.
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,6 @@ numpy
|
||||||
scipy
|
scipy
|
||||||
backoff
|
backoff
|
||||||
pathspec
|
pathspec
|
||||||
networkx<3.3 # 3.3 no longer works on python 3.9
|
|
||||||
diskcache
|
diskcache
|
||||||
grep_ast
|
grep_ast
|
||||||
packaging
|
packaging
|
||||||
|
@ -27,3 +26,10 @@ pypandoc
|
||||||
litellm
|
litellm
|
||||||
google-generativeai
|
google-generativeai
|
||||||
streamlit
|
streamlit
|
||||||
|
flake8
|
||||||
|
|
||||||
|
# v3.3 no longer works on python 3.9
|
||||||
|
networkx<3.3
|
||||||
|
|
||||||
|
# v0.22.2 seems to break tree-sitter-languages?
|
||||||
|
tree-sitter==0.21.3
|
||||||
|
|
|
@ -56,11 +56,13 @@ distro==1.9.0
|
||||||
# via openai
|
# via openai
|
||||||
filelock==3.14.0
|
filelock==3.14.0
|
||||||
# via huggingface-hub
|
# via huggingface-hub
|
||||||
|
flake8==7.0.0
|
||||||
|
# via -r requirements.in
|
||||||
frozenlist==1.4.1
|
frozenlist==1.4.1
|
||||||
# via
|
# via
|
||||||
# aiohttp
|
# aiohttp
|
||||||
# aiosignal
|
# aiosignal
|
||||||
fsspec==2024.3.1
|
fsspec==2024.5.0
|
||||||
# via huggingface-hub
|
# via huggingface-hub
|
||||||
gitdb==4.0.11
|
gitdb==4.0.11
|
||||||
# via gitpython
|
# via gitpython
|
||||||
|
@ -68,14 +70,14 @@ gitpython==3.1.43
|
||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# streamlit
|
# streamlit
|
||||||
google-ai-generativelanguage==0.6.2
|
google-ai-generativelanguage==0.6.4
|
||||||
# via google-generativeai
|
# via google-generativeai
|
||||||
google-api-core[grpc]==2.19.0
|
google-api-core[grpc]==2.19.0
|
||||||
# via
|
# via
|
||||||
# google-ai-generativelanguage
|
# google-ai-generativelanguage
|
||||||
# google-api-python-client
|
# google-api-python-client
|
||||||
# google-generativeai
|
# google-generativeai
|
||||||
google-api-python-client==2.128.0
|
google-api-python-client==2.129.0
|
||||||
# via google-generativeai
|
# via google-generativeai
|
||||||
google-auth==2.29.0
|
google-auth==2.29.0
|
||||||
# via
|
# via
|
||||||
|
@ -86,7 +88,7 @@ google-auth==2.29.0
|
||||||
# google-generativeai
|
# google-generativeai
|
||||||
google-auth-httplib2==0.2.0
|
google-auth-httplib2==0.2.0
|
||||||
# via google-api-python-client
|
# via google-api-python-client
|
||||||
google-generativeai==0.5.2
|
google-generativeai==0.5.4
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
googleapis-common-protos==1.63.0
|
googleapis-common-protos==1.63.0
|
||||||
# via
|
# via
|
||||||
|
@ -94,7 +96,7 @@ googleapis-common-protos==1.63.0
|
||||||
# grpcio-status
|
# grpcio-status
|
||||||
greenlet==3.0.3
|
greenlet==3.0.3
|
||||||
# via playwright
|
# via playwright
|
||||||
grep-ast==0.2.4
|
grep-ast==0.3.1
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
grpcio==1.63.0
|
grpcio==1.63.0
|
||||||
# via
|
# via
|
||||||
|
@ -133,12 +135,14 @@ jsonschema==4.22.0
|
||||||
# altair
|
# altair
|
||||||
jsonschema-specifications==2023.12.1
|
jsonschema-specifications==2023.12.1
|
||||||
# via jsonschema
|
# via jsonschema
|
||||||
litellm==1.36.2
|
litellm==1.37.16
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
markdown-it-py==3.0.0
|
markdown-it-py==3.0.0
|
||||||
# via rich
|
# via rich
|
||||||
markupsafe==2.1.5
|
markupsafe==2.1.5
|
||||||
# via jinja2
|
# via jinja2
|
||||||
|
mccabe==0.7.0
|
||||||
|
# via flake8
|
||||||
mdurl==0.1.2
|
mdurl==0.1.2
|
||||||
# via markdown-it-py
|
# via markdown-it-py
|
||||||
multidict==6.0.5
|
multidict==6.0.5
|
||||||
|
@ -156,7 +160,7 @@ numpy==1.26.4
|
||||||
# pydeck
|
# pydeck
|
||||||
# scipy
|
# scipy
|
||||||
# streamlit
|
# streamlit
|
||||||
openai==1.26.0
|
openai==1.30.1
|
||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# litellm
|
# litellm
|
||||||
|
@ -178,7 +182,7 @@ pillow==10.3.0
|
||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# streamlit
|
# streamlit
|
||||||
playwright==1.43.0
|
playwright==1.44.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
prompt-toolkit==3.0.43
|
prompt-toolkit==3.0.43
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
|
@ -195,7 +199,7 @@ protobuf==4.25.3
|
||||||
# grpcio-status
|
# grpcio-status
|
||||||
# proto-plus
|
# proto-plus
|
||||||
# streamlit
|
# streamlit
|
||||||
pyarrow==16.0.0
|
pyarrow==16.1.0
|
||||||
# via streamlit
|
# via streamlit
|
||||||
pyasn1==0.6.0
|
pyasn1==0.6.0
|
||||||
# via
|
# via
|
||||||
|
@ -203,6 +207,8 @@ pyasn1==0.6.0
|
||||||
# rsa
|
# rsa
|
||||||
pyasn1-modules==0.4.0
|
pyasn1-modules==0.4.0
|
||||||
# via google-auth
|
# via google-auth
|
||||||
|
pycodestyle==2.11.1
|
||||||
|
# via flake8
|
||||||
pycparser==2.22
|
pycparser==2.22
|
||||||
# via cffi
|
# via cffi
|
||||||
pydantic==2.7.1
|
pydantic==2.7.1
|
||||||
|
@ -211,10 +217,12 @@ pydantic==2.7.1
|
||||||
# openai
|
# openai
|
||||||
pydantic-core==2.18.2
|
pydantic-core==2.18.2
|
||||||
# via pydantic
|
# via pydantic
|
||||||
pydeck==0.9.0
|
pydeck==0.9.1
|
||||||
# via streamlit
|
# via streamlit
|
||||||
pyee==11.1.0
|
pyee==11.1.0
|
||||||
# via playwright
|
# via playwright
|
||||||
|
pyflakes==3.2.0
|
||||||
|
# via flake8
|
||||||
pygments==2.18.0
|
pygments==2.18.0
|
||||||
# via rich
|
# via rich
|
||||||
pypandoc==1.13
|
pypandoc==1.13
|
||||||
|
@ -235,7 +243,7 @@ referencing==0.35.1
|
||||||
# via
|
# via
|
||||||
# jsonschema
|
# jsonschema
|
||||||
# jsonschema-specifications
|
# jsonschema-specifications
|
||||||
regex==2024.4.28
|
regex==2024.5.15
|
||||||
# via tiktoken
|
# via tiktoken
|
||||||
requests==2.31.0
|
requests==2.31.0
|
||||||
# via
|
# via
|
||||||
|
@ -275,7 +283,7 @@ streamlit==1.34.0
|
||||||
# via -r requirements.in
|
# via -r requirements.in
|
||||||
tenacity==8.3.0
|
tenacity==8.3.0
|
||||||
# via streamlit
|
# via streamlit
|
||||||
tiktoken==0.6.0
|
tiktoken==0.7.0
|
||||||
# via
|
# via
|
||||||
# -r requirements.in
|
# -r requirements.in
|
||||||
# litellm
|
# litellm
|
||||||
|
@ -293,7 +301,9 @@ tqdm==4.66.4
|
||||||
# huggingface-hub
|
# huggingface-hub
|
||||||
# openai
|
# openai
|
||||||
tree-sitter==0.21.3
|
tree-sitter==0.21.3
|
||||||
# via tree-sitter-languages
|
# via
|
||||||
|
# -r requirements.in
|
||||||
|
# tree-sitter-languages
|
||||||
tree-sitter-languages==1.10.2
|
tree-sitter-languages==1.10.2
|
||||||
# via grep-ast
|
# via grep-ast
|
||||||
typing-extensions==4.11.0
|
typing-extensions==4.11.0
|
||||||
|
@ -315,5 +325,5 @@ wcwidth==0.2.13
|
||||||
# via prompt-toolkit
|
# via prompt-toolkit
|
||||||
yarl==1.9.4
|
yarl==1.9.4
|
||||||
# via aiohttp
|
# via aiohttp
|
||||||
zipp==3.18.1
|
zipp==3.18.2
|
||||||
# via importlib-metadata
|
# via importlib-metadata
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue