copilot_chat: Set Copilot output config only when effort exists (#54103) (cherry-pick to preview) (#54106)

zed-zippy[bot] , Ben Brandt , and John Tur created

Cherry-pick of #54103 to preview

----
It seems their verification got stricter, at least stricter than
Anthropics. Only set the output config if we have an effort.

Self-Review Checklist:

- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX

checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Closes #54036

Release Notes:

- copilot_chat: Fix invalid reasoning effort for some models.

Co-authored-by: John Tur <john-tur@outlook.com>

Co-authored-by: Ben Brandt <benjamin.j.brandt@gmail.com>
Co-authored-by: John Tur <john-tur@outlook.com>

Change summary

crates/language_models/src/provider/copilot_chat.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Detailed changes

crates/language_models/src/provider/copilot_chat.rs 🔗

@@ -405,7 +405,10 @@ impl LanguageModel for CopilotChatLanguageModel {
                 if model.supports_adaptive_thinking() {
                     if anthropic_request.thinking.is_some() {
                         anthropic_request.thinking = Some(anthropic::Thinking::Adaptive);
-                        anthropic_request.output_config = Some(anthropic::OutputConfig { effort });
+                        anthropic_request.output_config =
+                            effort.map(|effort| anthropic::OutputConfig {
+                                effort: Some(effort),
+                            });
                     }
                 }