Skip to content

fix(llms): classify gpt-5 dash family as reasoning models - #7116

Open
RahilOp wants to merge 1 commit into
mem0ai:mainfrom
RahilOp:fix/gpt-5-mini-reasoning-classification
Open

fix(llms): classify gpt-5 dash family as reasoning models#7116
RahilOp wants to merge 1 commit into
mem0ai:mainfrom
RahilOp:fix/gpt-5-mini-reasoning-classification

Conversation

@RahilOp

@RahilOp RahilOp commented Aug 26, 2026

Copy link
Copy Markdown

Problem

The default OSS config resolves model=None to gpt-5-mini, which is a reasoning model that rejects any non-default temperature. The existing _is_reasoning_model heuristic only matched the exact string gpt-5, so gpt-5-mini fell through to the temperature path. This caused every default Memory().add(...) to fail LLM extraction and silently store nothing.

Closes #6085

Changes

  • Updated mem0/llms/base.py to classify the GPT-5 dash family (gpt-5-mini, gpt-5-nano, and dated variants) as reasoning models.
  • Explicitly excluded gpt-5-chat* variants, which are non-reasoning chat models that still accept a custom temperature.
  • Added regression tests covering the classification and the end-to-end API call (no temperature is sent for the default gpt-5-mini).

Testing

MEM0_TELEMETRY=False hatch run pytest tests/llms/test_openai.py::test_is_reasoning_model_classification tests/llms/test_openai.py::test_default_gpt5_mini_omits_temperature -x

All tests pass. ruff check also passes.

Checklist

  • I have read the CLA Document and I sign the CLA

The default OSS config resolves model=None to gpt-5-mini, which rejects any

non-default temperature. The existing heuristic only matched the exact string

"gpt-5" and dot-versioned models were already excluded, so gpt-5-mini fell

through and caused every default add() to silently fail extraction.

Match the dash family (gpt-5-mini, gpt-5-nano, dated variants) while

excluding the chat variants (gpt-5-chat, gpt-5-chat-latest) which still

accept a custom temperature.

Closes mem0ai#6085

Signed-off-by: Mitulagr <iammrmitul@gmail.com>
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions Bot added the sdk-python Python SDK specific label Aug 26, 2026
@github-actions

Copy link
Copy Markdown

Hi @RahilOp, thanks for opening this pull request.

This is just a soft check: you are not yet in this repo's vouched contributor list (.github/VOUCHED.td). Nothing is blocked and there is nothing you need to do.

A maintainer can vouch for you by commenting !vouch @RahilOp on any issue.

@dlowzzxx dlowzzxx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified mem0/llms/base.py:75-87 correctly fixes #6085 where default config resolves model=None to gpt-5-mini — a reasoning model that rejects non-default temperature — so the old exact in reasoning_models check caused Memory().add() to silently fail and store nothing. The added if base_model.startswith("gpt-5-") and not base_model.startswith("gpt-5-chat"): return True cleanly partitions the dash family (gpt-5-mini, gpt-5-nano, dated variants with rsplit provider stripping) from non-reasoning gpt-5-chat* and dot-versioned gpt-5.4* which must keep temperature per tests/llms/test_openai.py:290. Reproduced locally that main returns False for gpt-5-mini and confirmed new tests tests/llms/test_openai.py:323-355 cover both paths. Narrow dash-prefix with explicit chat exclusion is the right minimal heuristic — LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk-python Python SDK specific

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OSS default config silently breaks add(): model=None resolves to gpt-5-mini, which rejects the default temperature=0.1

4 participants