Skip to content

Commit 524eb4f

Browse files
committed
Use lowest reasoning effort appropriate for a model
1 parent 6ae60e5 commit 524eb4f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

app/backend/approaches/approach.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,17 @@ def get_response_token_limit(self, model: str, default_limit: int) -> int:
412412

413413
return default_limit
414414

415+
def get_lowest_reasoning_effort(self, model: str) -> Optional[ChatCompletionReasoningEffort]:
416+
"""
417+
Return the lowest valid reasoning_effort for the given model.
418+
419+
Currently, "minimal" is only valid for the gpt-5 family.
420+
For other reasoning models, return "low".
421+
"""
422+
if model in {"gpt-5", "gpt-5-mini"}:
423+
return "minimal"
424+
return "low"
425+
415426
def create_chat_completion(
416427
self,
417428
chatgpt_deployment: Optional[str],

app/backend/approaches/chatreadretrieveread.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ async def run_search_approach(
162162
), # Setting too low risks malformed JSON, setting too high may affect performance
163163
temperature=0.0, # Minimize creativity for search query generation
164164
tools=tools,
165-
reasoning_effort="minimal", # Minimize reasoning for search query generation
165+
reasoning_effort=self.get_lowest_reasoning_effort(self.chatgpt_model),
166166
),
167167
)
168168

@@ -202,7 +202,7 @@ async def run_search_approach(
202202
model=self.chatgpt_model,
203203
deployment=self.chatgpt_deployment,
204204
usage=chat_completion.usage,
205-
reasoning_effort="minimal",
205+
reasoning_effort=self.get_lowest_reasoning_effort(self.chatgpt_model),
206206
),
207207
ThoughtStep(
208208
"Search using generated search query",

0 commit comments

Comments
 (0)