postChat dispatches via doPost; on a 400 rejecting reasoning it drops reasoning_effort for this Client's lifetime and retries once. Two wild flavours, both caught by substring match: newer OpenAI models ("reasoning_effort … not supported") and Ollama non-thinking models (" does not support th
(parent context.Context, body chatRequest)
| 377 | interFrame := min(idle, streamInterFrameTimeout) |
| 378 | var stalled, streaming atomic.Bool |
| 379 | window := atomic.Int64{} |
| 380 | window.Store(int64(idle)) |
| 381 | watchdog := time.AfterFunc(idle, func() { |
| 382 | stalled.Store(true) |
| 383 | resp.Body.Close() |
| 384 | }) |
| 385 | |
| 386 | budget := cloud.FromHeaders(resp.Header) |
| 387 | ctxWindow := cloud.ContextWindowFromHeaders(resp.Header) |
| 388 | final, tokens, promptTokens, err := readSSE(parent, resp.Body, budget, out, func(output bool) { |
| 389 | if output { |
| 390 | streaming.Store(true) |
| 391 | window.Store(int64(interFrame)) |
| 392 | } |
| 393 | watchdog.Reset(time.Duration(window.Load())) |
| 394 | }) |
| 395 | watchdog.Stop() |
| 396 | if err != nil { |