| 190 | if thinking.BudgetTokens != 0 { |
| 191 | return "thinking.budget_tokens is not supported when thinking.type is adaptive" |
| 192 | } |
| 193 | case "disabled": |
| 194 | if thinking.BudgetTokens != 0 { |
| 195 | return "thinking.budget_tokens is not supported when thinking.type is disabled" |
| 196 | } |
| 197 | default: |
| 198 | return "thinking.type must be one of: enabled, adaptive, disabled" |
| 199 | } |
| 200 | |
| 201 | display := strings.ToLower(strings.TrimSpace(thinking.Display)) |
| 202 | if display != "" && display != "summarized" && display != "omitted" { |
| 203 | return "thinking.display must be one of: summarized, omitted" |
| 204 | } |
| 205 | if kind == "disabled" && display != "" { |
| 206 | return "thinking.display is not supported when thinking.type is disabled" |
| 207 | } |
| 208 | |
| 209 | return "" |
| 210 | } |
| 211 | |
| 212 | type claudeThinkingResponseOptions struct { |
| 213 | Format string |
| 214 | OmitDisplay bool |
| 215 | } |
| 216 | |
| 217 | func resolveClaudeThinkingResponseOptions(thinking *ClaudeThinkingConfig, defaultFormat string) claudeThinkingResponseOptions { |
| 218 | opts := claudeThinkingResponseOptions{Format: defaultFormat} |
| 219 | if opts.Format == "" { |
| 220 | opts.Format = "thinking" |
| 221 | } |
| 222 | if thinking == nil { |
| 223 | return opts |
| 224 | } |
| 225 | |
| 226 | display := strings.ToLower(strings.TrimSpace(thinking.Display)) |
| 227 | switch display { |
| 228 | case "summarized": |
| 229 | opts.Format = "thinking" |
| 230 | case "omitted": |
| 231 | opts.Format = "thinking" |
| 232 | opts.OmitDisplay = true |