$ lexprog.com

// notes from an old coder -- php, databases, and the occasional rant

[October 01, 2026] AI

Keep Temperature Low for Tool Routing

When the model must pick a tool and fill JSON arguments, a low temperature reduces schema drift and invented function names.

────────────────────────────────────────────────────────

Keep Temperature Low for Tool Routing

Tip: Determinism beats creativity when calling tools

When the model must pick a tool and fill JSON arguments, a low temperature reduces schema drift and invented function names.

response = client.chat.completions.create(
    model="gpt-4.1",
    temperature=0.1,
    tools=tools,
    messages=messages,
)

Gotcha: Creative temperature invents tool names

At 0.8+ the model may emit a plausible-but-missing tool. Validate name against the allow-list before dispatch.

if call.name not in TOOLS:
    raise UnknownTool(call.name)

Source: https://platform.openai.com/docs/guides/function-calling

────────────────────────────────────────────────────────
<-- back to posts