Use sonnet by default; updated docs

This commit is contained in:
Paul Gauthier 2024-07-01 15:16:06 -03:00
parent c0a89c5cb8
commit 6dc7a8b4a4
15 changed files with 125 additions and 39 deletions

View file

@ -6,6 +6,7 @@
- Allow Claude 3.5 Sonnet to stream back >4k tokens!
- It is the first model capable of writing such large coherent, useful code edits.
- Do large refactors or generate multiple files of new code in one go.
- Aider now uses `claude-3-5-sonnet-20240620` by default if `ANTHROPIC_API_KEY` is set in the environment.
- Enabled [image support](https://aider.chat/docs/images-urls.html) for 3.5 Sonnet and for GPT-4o & 3.5 Sonnet via OpenRouter (by @yamitzky).
- Added `--attribute-commit-message` to prefix aider's commit messages with "aider:".
- Fixed regression in quality of one-line commit messages.

View file

@ -31,6 +31,7 @@ and works best with GPT-4o, Claude 3.5 Sonnet, Claude 3 Opus and DeepSeek Coder
# Because this page is rendered by GitHub as the repo README
cog.out(open("website/_includes/get-started.md").read())
]]]-->
You can get started quickly like this:
```
@ -43,14 +44,9 @@ $ cd /to/your/git/repo
$ export OPENAI_API_KEY=your-key-goes-here
$ aider
# Or, work with Anthropic's models
# Work with Claude 3.5 Sonnet on your repo
$ export ANTHROPIC_API_KEY=your-key-goes-here
# Claude 3 Opus
$ aider --opus
# Claude 3.5 Sonnet
$ aider --sonnet
$ aider
```
<!--[[[end]]]-->

View file

@ -6,7 +6,7 @@ import sys
import configargparse
from aider import __version__, models
from aider import __version__
from aider.args_formatter import (
DotEnvFormatter,
MarkdownHelpFormatter,
@ -44,12 +44,11 @@ def get_parser(default_config_files, git_root):
env_var="ANTHROPIC_API_KEY",
help="Specify the Anthropic API key",
)
default_model = models.DEFAULT_MODEL_NAME
group.add_argument(
"--model",
metavar="MODEL",
default=default_model,
help=f"Specify the model to use for the main chat (default: {default_model})",
default=None,
help="Specify the model to use for the main chat",
)
opus_model = "claude-3-opus-20240229"
group.add_argument(

View file

@ -403,6 +403,11 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
register_models(git_root, args.model_settings_file, io)
register_litellm_models(git_root, args.model_metadata_file, io)
if not args.model:
args.model = "gpt-4o"
if os.environ.get("ANTHROPIC_API_KEY"):
args.model = "claude-3-5-sonnet-20240620"
main_model = models.Model(args.model, weak_model=args.weak_model)
lint_cmds = parse_lint_cmds(args.lint_cmd, io)

View file

@ -17,6 +17,7 @@ cog.out(text)
- Allow Claude 3.5 Sonnet to stream back >4k tokens!
- It is the first model capable of writing such large coherent, useful code edits.
- Do large refactors or generate multiple files of new code in one go.
- Aider now uses `claude-3-5-sonnet-20240620` by default if `ANTHROPIC_API_KEY` is set in the environment.
- Enabled [image support](https://aider.chat/docs/images-urls.html) for 3.5 Sonnet and for GPT-4o & 3.5 Sonnet via OpenRouter (by @yamitzky).
- Added `--attribute-commit-message` to prefix aider's commit messages with "aider:".
- Fixed regression in quality of one-line commit messages.

View file

@ -1,3 +1,4 @@
You can get started quickly like this:
```
@ -10,12 +11,7 @@ $ cd /to/your/git/repo
$ export OPENAI_API_KEY=your-key-goes-here
$ aider
# Or, work with Anthropic's models
# Work with Claude 3.5 Sonnet on your repo
$ export ANTHROPIC_API_KEY=your-key-goes-here
# Claude 3 Opus
$ aider --opus
# Claude 3.5 Sonnet
$ aider --sonnet
$ aider
```

View file

@ -0,0 +1,93 @@
---
title: Sonnet is the opposite of lazy
excerpt: Claude 3.5 Sonnet represents a step change in AI coding.
#highlight_image: /assets/linting.jpg
draft: true
nav_exclude: true
---
{% if page.date %}
<p class="post-date">{{ page.date | date: "%B %d, %Y" }}</p>
{% endif %}
# Sonnet is the opposite of lazy
Claude 3.5 Sonnet represents a step change
in AI coding.
It is so industrious, diligent and hard working that
it has caused multiple problems for aider.
It's been worth the effort to adapt aider to work well
with Sonnet,
because the result is surprisingly powerful.
Sonnet's amazing work ethic caused a few problems:
1. Sonnet is capable of outputting a very large amount of correct,
complete code in one response.
So much that it can easily blow through the 4k output token limit
on API responses, which truncates its coding in mid-stream.
2. Similarly, Sonnet can specify large sequences of edits in one go,
like changing a majority of lines while refactoring a large file.
Again, this regularly triggered the 4k output limit
and resulted in a failed edits.
3. Sonnet is not shy about quoting large chunks of an
existing file to perform a SEARCH & REPLACE edit across
a long span of lines.
This can be wasteful and also trigger the 4k output limit.
## Good problems
Problems (1) and (2) are "good problems"
in the sense that Sonnet is
able to write more high quality code than any other model!
Aider now allows Sonnet to return code in multiple 4k token
responses.
This gets all the upsides of Sonnet's prolific coding skills,
without being constrained by the 4k output token limit.
## Wasting tokens
Problem (3) does cause some real downsides.
Faced with a few small changes spread far apart in
a source file,
Sonnet would often prefer to do one giant SEARCH/REPLACE
operation of the ~entire file.
This wastes a tremendous amount of tokens,
time and money -- and risks hitting the 4k output limit.
It would be far faster and less expensive to instead
do a few surgical edits.
Aider now prompts Sonnet to discourage these long-winded
SEARCH/REPLACE operations
and promotes much more concise edits.
## Aider with Sonnet
[The latest release of aider](https://aider.chat/HISTORY.html#aider-v0410)
has specialized support for Claude 3.5 Sonnet:
- Aider allows Sonnet to produce as much code as it wants,
by automatically and seamlessly spreading the response
out over a sequence of 4k token API responses.
- Aider carefully prompts Sonnet to be concise and
return only changing sections of code.
This reduces Sonnet's tendency to waste time, tokens and money
returning large chunks of unchanging code.
- Aider now uses `claude-3-5-sonnet-20240620` by default if `ANTHROPIC_API_KEY` is set in the environment.
You can use aider with Sonnet like this:
```
pip install aider-chat
export ANTHROPIC_API_KEY=<key> # Mac/Linux
setx ANTHROPIC_API_KEY <key> # Windows
aider
```

View file

@ -19,8 +19,8 @@
## Specify the Anthropic API key
#anthropic-api-key:
## Specify the model to use for the main chat (default: gpt-4o)
#model: gpt-4o
## Specify the model to use for the main chat
#model:
## Use claude-3-opus-20240229 model for the main chat
#opus: false

View file

@ -27,8 +27,8 @@
## Specify the Anthropic API key
#ANTHROPIC_API_KEY=
## Specify the model to use for the main chat (default: gpt-4o)
#AIDER_MODEL=gpt-4o
## Specify the model to use for the main chat
#AIDER_MODEL=
## Use claude-3-opus-20240229 model for the main chat
#AIDER_OPUS=

View file

@ -47,8 +47,8 @@ cog.outl("```")
## Specify the Anthropic API key
#anthropic-api-key:
## Specify the model to use for the main chat (default: gpt-4o)
#model: gpt-4o
## Specify the model to use for the main chat
#model:
## Use claude-3-opus-20240229 model for the main chat
#opus: false

View file

@ -60,8 +60,8 @@ cog.outl("```")
## Specify the Anthropic API key
#ANTHROPIC_API_KEY=
## Specify the model to use for the main chat (default: gpt-4o)
#AIDER_MODEL=gpt-4o
## Specify the model to use for the main chat
#AIDER_MODEL=
## Use claude-3-opus-20240229 model for the main chat
#AIDER_OPUS=

View file

@ -72,8 +72,7 @@ Specify the Anthropic API key
Environment variable: `ANTHROPIC_API_KEY`
### `--model MODEL`
Specify the model to use for the main chat (default: gpt-4o)
Default: gpt-4o
Specify the model to use for the main chat
Environment variable: `AIDER_MODEL`
### `--opus`

View file

@ -19,12 +19,12 @@ pip install aider-chat
export ANTHROPIC_API_KEY=<key> # Mac/Linux
setx ANTHROPIC_API_KEY <key> # Windows
# Aider uses Claude 3.5 Sonnet by default (or use --sonnet)
aider
# Claude 3 Opus
aider --opus
# Claude 3.5 Sonnet
aider --sonnet
# List models available from Anthropic
aider --models anthropic/
```

View file

@ -19,7 +19,7 @@ pip install aider-chat
export OPENAI_API_KEY=<key> # Mac/Linux
setx OPENAI_API_KEY <key> # Windows
# GPT-4o is the best model, used by default
# Aider uses gpt-4o by default (or use --4o)
aider
# GPT-4 Turbo (1106)

View file

@ -45,6 +45,7 @@ and works best with GPT-4o, Claude 3.5 Sonnet, Claude 3 Opus and DeepSeek Coder
# Because this page is rendered by GitHub as the repo README
cog.out(open("website/_includes/get-started.md").read())
-->
You can get started quickly like this:
```
@ -57,14 +58,9 @@ $ cd /to/your/git/repo
$ export OPENAI_API_KEY=your-key-goes-here
$ aider
# Or, work with Anthropic's models
# Work with Claude 3.5 Sonnet on your repo
$ export ANTHROPIC_API_KEY=your-key-goes-here
# Claude 3 Opus
$ aider --opus
# Claude 3.5 Sonnet
$ aider --sonnet
$ aider
```
<!-- NOOP -->