Files
Daniel Chalef f723545b73 feat(llm): default to gpt-5.5 with model-tied reasoning effort (#1551)
* feat(llm): default to gpt-5.5 with model-tied reasoning effort

Set the OpenAI client default model to gpt-5.5 and make the default reasoning
effort depend on the model instead of a single hardcoded value.

Reasoning has proven expensive and slow for Graphiti's structured-output
extraction workload without a meaningful quality gain, so gpt-5.5 now defaults
to reasoning_effort "none" (reasoning off).

Replaces the hardcoded DEFAULT_REASONING='minimal' with an 'auto' sentinel
resolved per-model by BaseOpenAIClient._resolve_reasoning_effort:
- gpt-5.5+  -> 'none'
- any other reasoning model -> unset (API default); we don't guess a floor
  because the lowest valid effort differs by snapshot (gpt-5.0 'minimal',
  gpt-5.4-mini 'low', gpt-5.5 'none')
- explicit reasoning= always passes through unchanged

This also supersedes #1395: rather than swapping the stale 'minimal'->'low'
hardcode (which breaks again on the next model), no invalid cross-model effort
is ever sent. Applied consistently to the OpenAI and Azure structured paths.

Note: DEFAULT_SMALL_MODEL stays gpt-4.1-nano (cheap, non-reasoning) for
small-size tasks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(llm): guard empty reasoning effort; clarify gpt-5.5 family wording

Address #1551 review:
- OpenAIClient now guards the reasoning effort on truthiness (matches the Azure
  client) so a stray reasoning='' is never sent as an invalid {'effort': ''}.
  Added a regression test.
- Clarify the _resolve_reasoning_effort docstring: it matches the gpt-5.5
  *family* by prefix (a future gpt-5.6/gpt-6 intentionally falls through, since
  newer snapshots may not accept 'none').

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(llm): no reasoning-effort regression; never send temperature to reasoning models

Two corrections to the gpt-5.5 default work:

1. Reasoning-effort regression: 'auto' previously resolved non-gpt-5.5 reasoning
   models to None, which omits reasoning_effort and lets the API apply its
   *medium* default — MORE reasoning/cost than the prior 'minimal' default.
   _resolve_reasoning_effort now falls back to 'minimal' (the long-standing
   default) for everything except gpt-5.5 (which stays 'none'). No model gets
   more reasoning than before; gpt-5.5 gets less.

2. Temperature on reasoning models: the structured path already omitted it, but
   OpenAIClient._create_completion passed temperature=None explicitly. It now
   builds the request kwargs and omits temperature entirely for reasoning models
   (gpt-5 family, o1, o3) — never sending it, not even None. (Azure already
   omits it on both paths.)

Tests: resolver matrix updated (non-5.5 -> 'minimal'); added a regression guard
(gpt-5 -> {'effort':'minimal'}, no temperature) and _create_completion
temperature omit/keep tests. ruff + pyright clean; 20 llm-client tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test(llm): use the real gpt-5.5 snapshot, not a fictional gpt-5.5-mini

There is no gpt-5.5-mini/-nano model (the gpt-5.5 family is just gpt-5.5,
snapshot gpt-5.5-2026-04-23; the small variants live in the gpt-5.4 family).
Replace the bogus test case with the real dated snapshot, which also verifies
the startswith('gpt-5.5') prefix matches dated snapshots. Code unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 10:49:18 -07:00
..
2025-04-16 12:35:07 -07:00
2025-07-05 08:57:07 -07:00