cleanup --model-metadata-file

This commit is contained in:
Paul Gauthier 2024-06-11 13:29:05 -07:00
parent 2f6e360188
commit fb3cc98da5
8 changed files with 60 additions and 49 deletions

View file

@ -89,6 +89,9 @@ cog.outl("```")
## Specify the OpenAI organization ID
#openai-organization-id:
## Specify a file with context window and costs for unknown models
#model-metadata-file:
## Specify what edit format the LLM should use (default depends on model)
#edit-format:

View file

@ -26,27 +26,6 @@ Put a line in it like this to specify your api key:
openai-api-key: sk-...
```
## Registering Models not in litellm
You can register model info and costs with litellm by adding one or more of the following files
* {HomeDir}/.aider.models.json
* {GitRoot}/.aider.models.json
* {CWD}/.aider.models.json
* or via the command line argument `model-file`
If the files above exists, they will be loaded in that order. Files loaded last will take priority.
The json file should be formated as follows
```
{
"gpt-4": {
"max_tokens": 8192,
"input_cost_per_token": 0.00003,
"output_cost_per_token": 0.00006,
"litellm_provider": "openai",
"mode": "chat",
},
}
```
see [litellm's model definitions](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) for examples
## Enable Playwright

View file

@ -6,3 +6,38 @@ nav_order: 900
# Model warnings
{% include model-warnings.md %}
## 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:
- Your home directory.
- The root if your git repo.
- The current directory where you launch aider.
- Or specify a specific file with the `--model-metadata-file <filename>` switch.
If the files above exist, they will be loaded in that order.
Files loaded last will take priority.
The json file should be a dictionary with an entry for each model, as follows:
```
{
"gpt-4": {
"max_tokens": 4096,
"max_input_tokens": 8192,
"max_output_tokens": 4096,
"input_cost_per_token": 0.00003,
"output_cost_per_token": 0.00006,
"litellm_provider": "openai",
"mode": "chat",
"supports_function_calling": true
}
}
```
See
[litellm's model_prices_and_context_window.json file](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json) for more examples.

View file

@ -19,7 +19,7 @@ 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]
[--edit-format] [--weak-model]
[--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]
@ -108,10 +108,6 @@ Aliases:
List known models which match the (partial) MODEL name
Environment variable: `AIDER_MODELS`
### `--model-file FILE`
Specify a file with model definitions (info and cost) to be registered with litellm, json formated. See [Registering Models not in litellm](install/optional.md#registering_models_not_in_litellm) for the format
Environment variable: `AIDER_MODEL_FILE`
### `--openai-api-base OPENAI_API_BASE`
Specify the api base url
Environment variable: `OPENAI_API_BASE`
@ -132,6 +128,10 @@ Environment variable: `OPENAI_API_DEPLOYMENT_ID`
Specify the OpenAI organization ID
Environment variable: `OPENAI_ORGANIZATION_ID`
### `--model-metadata-file MODEL_FILE`
Specify a file with context window and costs for unknown models
Environment variable: `AIDER_MODEL_METADATA_FILE`
### `--edit-format EDIT_FORMAT`
Specify what edit format the LLM should use (default depends on model)
Environment variable: `AIDER_EDIT_FORMAT`