Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion static/tool_search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,15 @@ def search_tools(
# Clamp max_results to valid range
max_results = max(1, min(20, max_results))

# Use provided model, instance default, or fallback to gpt-4.1-mini
# Use provided model, instance default, or fallback to gpt-4.1-mini.
# Tool search is a lightweight classification task — reasoning models
# are overkill and their max_completion_tokens budget includes internal
# reasoning tokens, so 500 tokens may not leave enough room for output.
# For OpenAI reasoning models, downgrade to gpt-4.1-mini automatically.
if model is None:
model = self.default_model or AIModel.from_identifier("gpt-4.1-mini")
if getattr(model, "is_reasoning_model", False) and getattr(model, "provider", "") == "openai":
model = AIModel.from_identifier("gpt-4.1-mini")

# Build the prompt
tool_descriptions = self.build_tool_descriptions()
Expand Down