mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
Added improved editing support for command-r-plus
This commit is contained in:
parent
b882d5db4c
commit
cd838901d1
4 changed files with 34 additions and 5 deletions
|
@ -312,7 +312,10 @@ separators = "|".join([HEAD, DIVIDER, UPDATED])
|
||||||
split_re = re.compile(r"^((?:" + separators + r")[ ]*\n)", re.MULTILINE | re.DOTALL)
|
split_re = re.compile(r"^((?:" + separators + r")[ ]*\n)", re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
missing_filename_err = f"Bad/missing filename. Filename should be alone on the line before {HEAD}"
|
missing_filename_err = (
|
||||||
|
"Bad/missing filename. The filename must be alone on the line before the opening fence"
|
||||||
|
" {fence[0]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def strip_filename(filename, fence):
|
def strip_filename(filename, fence):
|
||||||
|
@ -325,6 +328,9 @@ def strip_filename(filename, fence):
|
||||||
if filename.startswith(start_fence):
|
if filename.startswith(start_fence):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
filename = filename.rstrip(":")
|
||||||
|
filename = filename.strip("`")
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,12 +369,12 @@ def find_original_update_blocks(content, fence=DEFAULT_FENCE):
|
||||||
if current_filename:
|
if current_filename:
|
||||||
filename = current_filename
|
filename = current_filename
|
||||||
else:
|
else:
|
||||||
raise ValueError(missing_filename_err)
|
raise ValueError(missing_filename_err.format(fence=fence))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
if current_filename:
|
if current_filename:
|
||||||
filename = current_filename
|
filename = current_filename
|
||||||
else:
|
else:
|
||||||
raise ValueError(missing_filename_err)
|
raise ValueError(missing_filename_err.format(fence=fence))
|
||||||
|
|
||||||
current_filename = filename
|
current_filename = filename
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@ class WholeFileCoder(Coder):
|
||||||
fname_source = "block"
|
fname_source = "block"
|
||||||
fname = lines[i - 1].strip()
|
fname = lines[i - 1].strip()
|
||||||
fname = fname.strip("*") # handle **filename.py**
|
fname = fname.strip("*") # handle **filename.py**
|
||||||
|
fname = fname.rstrip(":")
|
||||||
|
fname = fname.strip("`")
|
||||||
|
|
||||||
# Did gpt prepend a bogus dir? It especially likes to
|
# Did gpt prepend a bogus dir? It especially likes to
|
||||||
# include the path/to prefix from the one-shot example in
|
# include the path/to prefix from the one-shot example in
|
||||||
|
|
|
@ -117,6 +117,14 @@ MODEL_SETTINGS = [
|
||||||
use_repo_map=True,
|
use_repo_map=True,
|
||||||
send_undo_reply=True,
|
send_undo_reply=True,
|
||||||
),
|
),
|
||||||
|
# Cohere
|
||||||
|
ModelSettings(
|
||||||
|
"command-r-plus",
|
||||||
|
"whole",
|
||||||
|
weak_model_name="command-r-plus",
|
||||||
|
use_repo_map=True,
|
||||||
|
send_undo_reply=True,
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -187,6 +195,8 @@ class Model:
|
||||||
return # <--
|
return # <--
|
||||||
|
|
||||||
# use the defaults
|
# use the defaults
|
||||||
|
if self.edit_format == "diff":
|
||||||
|
self.use_repo_map = True
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
15
docs/llms.md
15
docs/llms.md
|
@ -4,9 +4,11 @@
|
||||||
Aider works well with OpenAI's GPT 3.5, GPT-4, GPT-4 Turbo with Vision and
|
Aider works well with OpenAI's GPT 3.5, GPT-4, GPT-4 Turbo with Vision and
|
||||||
Anthropic's Claude 3 Opus and Sonnet.
|
Anthropic's Claude 3 Opus and Sonnet.
|
||||||
|
|
||||||
GPT-4 Turbo and Claude 3 Opus are recommended for the best results.
|
GPT-4 Turbo and Claude 3 Opus are recommended, as they are the very best coding assistants.
|
||||||
|
Cohere offers *free* API access to their Command-R+ model, which works well with aider
|
||||||
|
as a *very basic* coding assistant.
|
||||||
|
|
||||||
Aider also supports connecting to almost any LLM,
|
Aider supports connecting to almost any LLM,
|
||||||
but it may not work well with some models depending on their capabilities.
|
but it may not work well with some models depending on their capabilities.
|
||||||
For example, GPT-3.5 is just barely capable of reliably *editing code* to provide aider's
|
For example, GPT-3.5 is just barely capable of reliably *editing code* to provide aider's
|
||||||
interactive "pair programming" style workflow.
|
interactive "pair programming" style workflow.
|
||||||
|
@ -14,6 +16,7 @@ So you should expect that models which are less capable than GPT-3.5 may struggl
|
||||||
|
|
||||||
- [OpenAI](#openai)
|
- [OpenAI](#openai)
|
||||||
- [Anthropic](#anthropic)
|
- [Anthropic](#anthropic)
|
||||||
|
- [Cohere](#cohere)
|
||||||
- [Azure](#azure)
|
- [Azure](#azure)
|
||||||
- [OpenAI compatible APIs](#openai-compatible-apis)
|
- [OpenAI compatible APIs](#openai-compatible-apis)
|
||||||
- [Other LLMs](#other-llms)
|
- [Other LLMs](#other-llms)
|
||||||
|
@ -54,6 +57,14 @@ You can use `aider --model <model-name>` to use any other Anthropic model.
|
||||||
For example, if you want to use a specific version of Opus
|
For example, if you want to use a specific version of Opus
|
||||||
you could do `aider --model claude-3-opus-20240229`.
|
you could do `aider --model claude-3-opus-20240229`.
|
||||||
|
|
||||||
|
## Cohere
|
||||||
|
|
||||||
|
To work with Cohere's models, you need to provide your
|
||||||
|
[Cohere API key](https://dashboard.cohere.com/)
|
||||||
|
in the `COHERE_API_KEY` environment variable.
|
||||||
|
|
||||||
|
- **Command-R+**: `aider --model command-r-plus`
|
||||||
|
|
||||||
## Azure
|
## Azure
|
||||||
|
|
||||||
Aider can be configured to connect to the OpenAI models on Azure.
|
Aider can be configured to connect to the OpenAI models on Azure.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue