mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-19 15:10:34 +01:00
7ea5428f0c
## Summary Improve custom model support for Amazon Bedrock (**not** Mantle). Add the ability to specify existing model configuration settings in custom models. Specifying custom Amazon Bedrock Converse models is useful for a few key reasons: - Adding new models before Zed adds support - ex. Grok 4.6 was added 8/19, but is not yet added to the Zed agent picker. - Using application inference profiles to track individual usage - Using fully custom models uploaded and hosted in Bedrock Custom models should be as configurable as the provided models can be. Currently, they are not. Thinking, tools, and image support cannot be configured for custom models. This PR adds support for these settings. Configuration Changes for objects under `language_models` -> `bedrock` -> `available_models`: - Added `supports_tools` bool value to indicate that the model supports tool use - Added `supports_images` bool value to indicate that the model supports image recognition - Added `thinking` key that can either be a bool to enable basic thinking, or an object to describe additional thinking details: - `adaptive` bool to indicate whether model thinking can have adaptive levels (low, high, medium, etc.) - `has_xhigh` bool to indicate whether the model supports the xhigh adaptive thinking level. Unused if `adaptive` is false - `budget_tokens` to specify how many tokens the model can use for a thinking operation The new configuration format is mostly backwards compatible with the old format. i.e. **most** existing configurations will not break if this fix is merged. The only exception is now custom model `name`s are completely unmodified instead of potentially having a region prefix added to them. The user is responsible for making sure the `us.` (or whatever region) prefix is added to the model identifier. `allow_global` will have no impact on these models and they will be used if specified even if they are global models. I can change this behavior if it is desired. I think custom should be fully custom, though. We can optionally bounce a model specifier if it does not have a region prefix or has the `global` prefix if `allow_global` is false. I am open to feedback on the configuration keys and values. Misc changes: - The default `default_temperature` value for custom models is now `None` instead of 1.0. Some models do not support temperature and a default of 1.0 is still a value that the Bedrock endpoint will reject. ## Testing - Existing automated unit tests pass - Newly added automated unit tests pass - Tested manually with models currently unsupported in Zed (Grok 4.6/4.7, Kimi K3) - Models show up, function properly, show thinking level settings (incl. xhigh, if `has_xhigh` specified), can use tools, can add images - Manually tested model with custom ARN (application inference profile) ## Self-review - [X] I've reviewed my diff for quality, security, reliability, and performance. - [N/A] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [X] Tests cover the new or changed behavior. Release Notes: - Improved custom model support for Amazon Bedrock --------- Co-authored-by: Christopher Biscardi <chris@christopherbiscardi.com>