add support to load/override model settings

This commit is contained in:
Krazer 2024-06-11 17:15:48 -05:00
parent 6216a273fe
commit 486c5ce65c
5 changed files with 131 additions and 36 deletions

View file

@ -8,10 +8,45 @@ nav_order: 900
{% include model-warnings.md %}
## Adding settings for missing models
You can register model settings used by aider for unknown models.
Create a `.aider.models.yml` file in one of these locations:
- Your home directory.
- The root if your git repo.
- The current directory where you launch aider.
- Or specify a specific file with the `--model-settings-file <filename>` switch.
If the files above exist, they will be loaded in that order.
Files loaded last will take priority.
The yaml file should be a a list of dictionary objects for each model, as follows:
```
- name: "gpt-3.5-turbo"
edit_format: "whole"
weak_model_name: "gpt-3.5-turbo"
use_repo_map: false
send_undo_reply: false
accepts_images: false
lazy: false
reminder_as_sys_msg: true
examples_as_sys_msg: false
- name: "gpt-4-turbo-2024-04-09"
edit_format: "udiff"
weak_model_name: "gpt-3.5-turbo"
use_repo_map: true
send_undo_reply: true
accepts_images: true
lazy: true
reminder_as_sys_msg: true
examples_as_sys_msg: false
```
## Specifying context window size and token costs
You can register context window limits and costs for models that aren't known
to aider. Create a `.aider.models.json` file in one of these locations:
to aider. Create a `.aider.litellm.models.json` file in one of these locations:
- Your home directory.
- The root if your git repo.

View file

@ -19,7 +19,8 @@ usage: aider [-h] [--vim] [--openai-api-key] [--anthropic-api-key]
[--35turbo] [--models] [--openai-api-base]
[--openai-api-type] [--openai-api-version]
[--openai-api-deployment-id] [--openai-organization-id]
[--model-metadata-file] [--edit-format] [--weak-model]
[--model-settings-file] [--model-metadata-file]
[--edit-format] [--weak-model]
[--show-model-warnings | --no-show-model-warnings]
[--map-tokens] [--max-chat-history-tokens] [--env-file]
[--input-history-file] [--chat-history-file]
@ -128,6 +129,10 @@ Environment variable: `OPENAI_API_DEPLOYMENT_ID`
Specify the OpenAI organization ID
Environment variable: `OPENAI_ORGANIZATION_ID`
### `--model-settings-file MODEL_FILE`
Specify a file with aider model settings for unknown models
Environment variable: `AIDER_MODEL_SETTINGS_FILE`
### `--model-metadata-file MODEL_FILE`
Specify a file with context window and costs for unknown models
Environment variable: `AIDER_MODEL_METADATA_FILE`