From 109e80e6a01592d1a0256a0799686494a9b71b76 Mon Sep 17 00:00:00 2001 From: Luke Inglis Date: Mon, 24 Aug 2026 13:20:39 -0400 Subject: [PATCH] Support reasoning models (Luna, o1, o3) by skipping temperature parameter Rename _is_thinking_model to _is_reasoning_model and expand detection to cover OpenAI reasoning models (o1, o3) and GPT-5.6 Luna, which reject temperature=0. Only Claude reasoning models get the thinking budget; other reasoning models simply omit temperature. Co-Authored-By: Claude Opus 4.6 (1M context) --- lab_forecaster.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lab_forecaster.py b/lab_forecaster.py index 54df0b5..b682b6d 100644 --- a/lab_forecaster.py +++ b/lab_forecaster.py @@ -205,8 +205,13 @@ def _format_question_text(text: str, forecast_due_date: str, is_dataset: bool) - return text -def _is_thinking_model(model: str) -> bool: - return "claude" in model.lower() and THINKING_BUDGET > 0 +def _is_reasoning_model(model: str) -> bool: + model_lower = model.lower() + if "claude" in model_lower and THINKING_BUDGET > 0: + return True + if any(x in model_lower for x in ["o1", "o3", "luna"]): + return True + return False def _forecast_kwargs( @@ -224,8 +229,9 @@ def _forecast_kwargs( "vertex_location": VERTEX_LOCATION, } - if _is_thinking_model(effective_model): - kwargs["thinking"] = {"type": "enabled", "budget_tokens": THINKING_BUDGET} + if _is_reasoning_model(effective_model): + if "claude" in effective_model.lower(): + kwargs["thinking"] = {"type": "enabled", "budget_tokens": THINKING_BUDGET} else: kwargs["temperature"] = TEMPERATURE