fix(llms): classify gpt-5 dash family as reasoning models - #7116
Conversation
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>
|
|
|
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 ( A maintainer can vouch for you by commenting |
dlowzzxx
left a comment
There was a problem hiding this comment.
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
Problem
The default OSS config resolves
model=Nonetogpt-5-mini, which is a reasoning model that rejects any non-defaulttemperature. The existing_is_reasoning_modelheuristic only matched the exact stringgpt-5, sogpt-5-minifell through to the temperature path. This caused every defaultMemory().add(...)to fail LLM extraction and silently store nothing.Closes #6085
Changes
mem0/llms/base.pyto classify the GPT-5 dash family (gpt-5-mini,gpt-5-nano, and dated variants) as reasoning models.gpt-5-chat*variants, which are non-reasoning chat models that still accept a custom temperature.temperatureis sent for the defaultgpt-5-mini).Testing
All tests pass.
ruff checkalso passes.Checklist