You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
OpenAI backend silently returns empty string when model produces no text content (content=None) #1060
When using OpenAIBackend with a thinking model that returns content=null (i.e. the model emits reasoning tokens only, no text output), result.value is silently "". The sampling loop reports SUCCESS, finish_reason is stop, and token usage is non-zero — there is no signal that anything went wrong.
Reproducer
frommelleaimportstart_session# Qwen3 models default to thinking mode; without disable, content=Nonesession=start_session(
"openai",
model_id="Qwen/Qwen3-Coder-Next-FP8",
base_url="http://localhost:59691/v1",
api_key="unused",
)
result=session.instruct("What is 2 + 2?")
print(repr(result.value)) # '' ← silent empty stringprint(result.generation.usage) # {'completion_tokens': 9, ...} ← tokens were generated
When content is None, accumulation is silently skipped, leaving _underlying_value = "". The ComputedModelOutputThunk constructor checks for None but not for empty string, so the empty result propagates up unchecked.
Expected behaviour
When content=None and finish_reason=stop, mellea should raise a MelleaError (or at minimum emit a warning) indicating the model returned no text content — likely because the model is operating in thinking-only mode. The error message should suggest passing enable_thinking: False via model_options for OpenAI-compatible thinking models:
Activity
fix(backends): raise error when OpenAI backend receives content=None
fix(backends): raise error when OpenAI backend receives content=None
docs(openai): document empty value from thinking-mode models
docs(openai): document empty value from thinking-mode models (generat…
docs(openai): document empty value from thinking-mode models (generat…