feat: add extra_bodyfield and use in model settings.

resolved: #1583

The `extra_body` field is a parameter used by the `openai` provider.

Since `litellm` also uses this field to additionally transmit `request body`, I added a function so that `aider` can also utilize the `extra_body` field.

The `openrouter` provider also supports various functions through the additional field of `request body`, so we added the function.

The following is how to use it in model settings.
```yaml
# .aider.model.settings.yml
- name: "openrouter/<YOUR_MODEL>"
  edit_format: "whole"
  use_repo_map: true
  extra_body:
    provider:
      order:
      - Azure
      allow_fallbacks: false
```
This commit is contained in:
hypn4 2024-09-19 16:59:05 +09:00
parent ca4141564f
commit d0bce02c00
3 changed files with 7 additions and 0 deletions

View file

@ -74,6 +74,7 @@ class ModelSettings:
reminder: str = "user"
examples_as_sys_msg: bool = False
extra_headers: Optional[dict] = None
extra_body: Optional[dict] = None
max_tokens: Optional[int] = None
cache_control: bool = False
caches_by_default: bool = False