diff --git a/aider/main.py b/aider/main.py index c9f1d3593..1bca3eae8 100644 --- a/aider/main.py +++ b/aider/main.py @@ -205,6 +205,7 @@ def main(argv=None, input=None, output=None, force_git_root=None): core_group.add_argument( "--4turbo", "--4-turbo", + "--4-turbo-vision", action="store_const", dest="model", const=default_4_turbo_model, diff --git a/aider/models.py b/aider/models.py index 533b0dbda..44683dad6 100644 --- a/aider/models.py +++ b/aider/models.py @@ -232,12 +232,12 @@ class Model: def check_model_name(model): - res = f"Unknown model: {model}" + res = f"Unknown model {model}" possible_matches = fuzzy_match_models(model) if possible_matches: - res += "\n\nDid you mean one of these:\n" + res += ", did you mean one of these?" for match in possible_matches: res += "\n- " + match diff --git a/docs/connect.md b/docs/connect.md index d19f78267..dc9b9d106 100644 --- a/docs/connect.md +++ b/docs/connect.md @@ -4,11 +4,13 @@ Aider works well with OpenAI's GPT 3.5, GPT-4, GPT-4 Turbo with Vision and Anthropic's Claude 3 Opus and Sonnet. +GPT-4 Turbo and Claude 3 Opus are recommended for the best results. + Aider also has support for connecting to almost any LLM, but may not be as effective -because of the reduced capabilities of such alternative models. +depending on the capabilities of the model. For comparison, GPT-3.5 is just barely capable of *editing code* to provide aider's interactive "pair programming" style workflow. -So models that are less capable than GPT-3.5 may struggle to perform well with aider. +Models that are less capable than GPT-3.5 may struggle to perform well with aider. ## OpenAI @@ -20,11 +22,13 @@ via the `--openai-api-key` command line switch. Aider has some built in shortcuts for the most popular OpenAI models and has been tested and benchmarked to work well with them: -- OpenAI's GPT-4 Turbo: `aider` with no args uses GPT-4 Turbo by default. -- OpenAI's GPT-4 Turbo with Vision: `aider --4turbo` will use this vision capable model, allowing you to share images with GPT by adding them to the chat with `/add` or by naming them on the command line. -- OpenAI's GPT-3.5 Turbo: `aider --35turbo` +- OpenAI's GPT-4 Turbo: run `aider` with no args uses GPT-4 Turbo by default. +- OpenAI's GPT-4 Turbo with Vision: run `aider --4-turbo-vision` to use this vision capable model, allowing you to share images with GPT by adding them to the chat with `/add` or by naming them on the command line. +- OpenAI's GPT-3.5 Turbo: Run `aider --35-turbo`. You can use `aider --model ` to use any other OpenAI model. +For example, if you want to use a specific version of GPT-4 Turbo +you could do `aider --model gpt-4-0125-preview`. ## Anthropic @@ -40,6 +44,8 @@ has been tested and benchmarked to work well with them: - Anthropic's Claude 3 Sonnet: `aider --sonnet` You can use `aider --model ` to use any other Anthropic model. +For example, if you want to use a specific version of Opus +you could do `aider --model claude-3-opus-20240229`. ## Azure @@ -88,33 +94,30 @@ you can use `--openai-api-base` to connect to a different API endpoint. ## Other LLMs Aider uses the [litellm](https://docs.litellm.ai/docs/providers) package -to provide connections to hundreds of other models. -You can use `aider --model /` to use any supported model. - -Depending on which model you access, you may need to provide an API key -or other configuration parameters by setting certain environment variables. -If any required variables are not set, aider will print a brief -error message listing which parameters are needed. +to connect to hundreds of other models. +You can use `aider --model ` to use any supported model. To explore the list of supported models you can run `aider --model `. If it's not an exact match for a model, aider will return a list of possible matching models. -For example `aider --model 3.5` will return the following list of models: +For example: +``` +$ aider --model turbo + +Unknown model turbo, did you mean one of these? +- gpt-4-turbo-preview +- gpt-4-turbo +- gpt-4-turbo-2024-04-09 - gpt-3.5-turbo - gpt-3.5-turbo-0301 -- gpt-3.5-turbo-0613 -- gpt-3.5-turbo-1106 -- gpt-3.5-turbo-0125 -- gpt-3.5-turbo-16k -- gpt-3.5-turbo-16k-0613 -- ft:gpt-3.5-turbo -- azure/gpt-3.5-turbo-instruct-0914 -- gpt-3.5-turbo-instruct -- gpt-3.5-turbo-instruct-0914 -- openrouter/openai/gpt-3.5-turbo -- openrouter/openai/gpt-3.5-turbo-16k -- deepinfra/openchat/openchat_3.5 +... +``` + +Depending on which model you access, you may need to provide an API key +or other configuration parameters by setting certain environment variables. +If any required variables are not set, aider will print an +error message listing which parameters are needed. Or, see the [list of providers supported by litellm](https://docs.litellm.ai/docs/providers) for more details. diff --git a/docs/faq.md b/docs/faq.md index 17758c4de..01b1e7c1b 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -2,14 +2,13 @@ # Frequently asked questions - [How does aider use git?](#how-does-aider-use-git) -- [Can I use aider with other LLMs, local LLMs, etc?](#can-i-use-aider-with-other-llms-local-llms-etc) -- [Accessing other LLMs with OpenRouter](#accessing-other-llms-with-openrouter) -- [Aider isn't editing my files?](#aider-isnt-editing-my-files) +- [Can I use aider with other LLMs, local LLMs, etc?](https://aider.chat/docs/connect.html) - [Can I run aider in Google Colab?](#can-i-run-aider-in-google-colab) - [How can I run aider locally from source code?](#how-can-i-run-aider-locally-from-source-code) - [Can I script aider?](#can-i-script-aider) - [What code languages does aider support?](#what-code-languages-does-aider-support) - [How to use pipx to avoid python package conflicts?](#how-to-use-pipx-to-avoid-python-package-conflicts) +- [Aider isn't editing my files?](#aider-isnt-editing-my-files) - [How can I add ALL the files to the chat?](#how-can-i-add-all-the-files-to-the-chat) - [Can I specify guidelines or conventions?](#can-i-specify-guidelines-or-conventions) - [Can I change the system prompts that aider uses?](#can-i-change-the-system-prompts-that-aider-uses) @@ -39,68 +38,6 @@ While it is not recommended, you can disable aider's use of git in a few ways: - `--no-dirty-commits` will stop aider from committing dirty files before applying GPT's edits. - `--no-git` will completely stop aider from using git on your files. You should ensure you are keeping sensible backups of the files you are working with. -## Can I use aider with other LLMs, local LLMs, etc? - -Aider provides experimental support for LLMs other than OpenAI's GPT-3.5 and GPT-4. The support is currently only experimental for two reasons: - -- GPT-3.5 is just barely capable of *editing code* to provide aider's interactive "pair programming" style workflow. None of the other models seem to be as capable as GPT-3.5 yet. -- Just "hooking up" aider to a new model by connecting to its API is almost certainly not enough to get it working in a useful way. Getting aider working well with GPT-3.5 and GPT-4 was a significant undertaking, involving [specific code editing prompts and backends for each model and extensive benchmarking](https://aider.chat/docs/benchmarks.html). Officially supporting each new LLM will probably require a similar effort to tailor the prompts and editing backends. - -Numerous users have done experiments with numerous models. None of these experiments have yet identified other models that look like they are capable of working well with aider. - -Once we see signs that a *particular* model is capable of code editing, it would be reasonable for aider to attempt to officially support such a model. Until then, aider will simply maintain experimental support for using alternative models. - -There are ongoing discussions about [LLM integrations in the aider discord](https://discord.gg/yaUk7JqJ9G). - -Here are some [GitHub issues which may contain relevant information](https://github.com/paul-gauthier/aider/issues?q=is%3Aissue+%23172). - -### OpenAI API compatible LLMs - -If you can make the model accessible via an OpenAI compatible API, -you can use `--openai-api-base` to connect to a different API endpoint. - -### Local LLMs - -[LiteLLM](https://github.com/BerriAI/litellm) and -[LocalAI](https://github.com/go-skynet/LocalAI) -are relevant tools to serve local models via an OpenAI compatible API. - - -### Azure - -See the documentation on connection to LLMs for details on -[connecting aider to Azure](). - -## Accessing other LLMs with OpenRouter - -See the documentation on connection to LLMs for details on -[connecting aider to OpenRouter](). - -## Aider isn't editing my files? - -Sometimes GPT will reply with some code changes that don't get applied to your local files. -In these cases, aider might say something like "Failed to apply edit to *filename*". - -This usually happens because GPT is not specifying the edits -to make in the format that aider expects. -GPT-3.5 is especially prone to disobeying the system prompt instructions in this manner, but it also happens with GPT-4. - -Aider makes every effort to get GPT to conform, and works hard to deal with -replies that are "almost" correctly formatted. -If Aider detects an improperly formatted reply, it gives GPT feedback to try again. -Also, before each release new versions of aider are -[benchmarked](https://aider.chat/docs/benchmarks.html). -This helps prevent regressions in the code editing -performance of GPT that could have been inadvertantly -introduced. - -But sometimes GPT just won't cooperate. -In these cases, here are some things you might try: - - - Try the older GPT-4 model `gpt-4-0613` not GPT-4 Turbo by running `aider --model gpt-4-0613`. - - Use `/drop` to remove files from the chat session which aren't needed for the task at hand. This will reduce distractions and may help GPT produce properly formatted edits. - - Use `/clear` to remove the conversation history, again to help GPT focus. - ## Can I run aider in Google Colab? @@ -275,6 +212,31 @@ Install [pipx](https://pipx.pypa.io/stable/) then just do: pipx install aider-chat ``` +## Aider isn't editing my files? + +Sometimes GPT will reply with some code changes that don't get applied to your local files. +In these cases, aider might say something like "Failed to apply edit to *filename*". + +This usually happens because GPT is not specifying the edits +to make in the format that aider expects. +GPT-3.5 is especially prone to disobeying the system prompt instructions in this manner, but it also happens with GPT-4. + +Aider makes every effort to get GPT to conform, and works hard to deal with +replies that are "almost" correctly formatted. +If Aider detects an improperly formatted reply, it gives GPT feedback to try again. +Also, before each release new versions of aider are +[benchmarked](https://aider.chat/docs/benchmarks.html). +This helps prevent regressions in the code editing +performance of GPT that could have been inadvertantly +introduced. + +But sometimes GPT just won't cooperate. +In these cases, here are some things you might try: + + - Try the older GPT-4 model `gpt-4-0613` not GPT-4 Turbo by running `aider --model gpt-4-0613`. + - Use `/drop` to remove files from the chat session which aren't needed for the task at hand. This will reduce distractions and may help GPT produce properly formatted edits. + - Use `/clear` to remove the conversation history, again to help GPT focus. + ## How can I add ALL the files to the chat? People regularly ask about how to add **many or all of their repo's files** to the chat.