|
315 | 315 | efforts)) |
316 | 316 |
|
317 | 317 | :anthropic |
318 | | - (cond |
319 | | - (and efforts adaptive?) |
320 | | - (into {} |
321 | | - (map (fn [effort] |
322 | | - [effort {:thinking (cond-> {:type "adaptive"} |
323 | | - ;; Opus 4.7 defaults adaptive thinking display to "omitted", which |
324 | | - ;; produces empty thinking blocks. Request summaries explicitly. |
325 | | - (re-find #"(?i)opus[-._]4[-._]7(?:$|[-._])" model-id) |
326 | | - (assoc :display "summarized")) |
327 | | - :output_config {:effort effort}}])) |
328 | | - efforts) |
329 | | - |
330 | | - ;; Some Copilot Messages models (for example Claude Opus/Sonnet 4.6) advertise |
331 | | - ;; budget bounds instead of named reasoning efforts. Project that range into |
332 | | - ;; the existing variant picker without exposing raw token budgets in the UI. |
333 | | - (and (number? max-budget) (pos? max-budget)) |
334 | | - (let [min-value (max 1024 (long (if (number? min-budget) min-budget 1024))) |
335 | | - max-value (dec (long max-budget)) |
336 | | - high-value (max min-value (quot (long max-budget) 2))] |
337 | | - (when (<= min-value max-value) |
338 | | - {"high" {:thinking {:type "enabled" |
339 | | - :budget_tokens high-value}} |
340 | | - "max" {:thinking {:type "enabled" |
341 | | - :budget_tokens max-value}}})) |
342 | | - |
343 | | - :else nil) |
| 318 | + (let [adaptive-thinking (cond-> {:type "adaptive"} |
| 319 | + ;; Opus 4.7 defaults adaptive thinking display to "omitted", which |
| 320 | + ;; produces empty thinking blocks. Request summaries explicitly. |
| 321 | + (re-find #"(?i)opus[-._]4[-._]7(?:$|[-._])" model-id) |
| 322 | + (assoc :display "summarized"))] |
| 323 | + (cond |
| 324 | + ;; Adaptive-thinking models (Opus 4.7+/Sonnet 5+) reject thinking.type |
| 325 | + ;; "enabled", so a "default" variant keeps no-variant requests on |
| 326 | + ;; adaptive instead of the enabled fallback in the provider (#528). |
| 327 | + (and efforts adaptive?) |
| 328 | + (into {"default" {:thinking adaptive-thinking}} |
| 329 | + (map (fn [effort] |
| 330 | + [effort {:thinking adaptive-thinking |
| 331 | + :output_config {:effort effort}}])) |
| 332 | + efforts) |
| 333 | + |
| 334 | + adaptive? |
| 335 | + {"default" {:thinking adaptive-thinking}} |
| 336 | + |
| 337 | + ;; Some Copilot Messages models (for example Claude Opus/Sonnet 4.5) advertise |
| 338 | + ;; budget bounds instead of named reasoning efforts. Project that range into |
| 339 | + ;; the existing variant picker without exposing raw token budgets in the UI. |
| 340 | + (and (number? max-budget) (pos? max-budget)) |
| 341 | + (let [min-value (max 1024 (long (if (number? min-budget) min-budget 1024))) |
| 342 | + max-value (dec (long max-budget)) |
| 343 | + high-value (max min-value (quot (long max-budget) 2))] |
| 344 | + (when (<= min-value max-value) |
| 345 | + {"high" {:thinking {:type "enabled" |
| 346 | + :budget_tokens high-value}} |
| 347 | + "max" {:thinking {:type "enabled" |
| 348 | + :budget_tokens max-value}}})) |
| 349 | + |
| 350 | + :else nil)) |
344 | 351 |
|
345 | 352 | nil))) |
346 | 353 |
|
|
0 commit comments