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
bug(backends): OpenAIBackend intrinsic path raises TypeError when user passes extra_body in model_options #1241
OpenAIBackend._generate_from_intrinsic() raises TypeError: got multiple values for keyword argument 'extra_body' if a caller passes extra_body in model_options.
Root cause
The intrinsic call site passes extra_body as an explicit keyword argument alongside **api_params:
# openai.py ~line 712chat_response=self._async_client.chat.completions.create(
model=self._model_id,
messages=messages_dicts,
tools=formatted_toolsifuse_toolselseNone,
extra_body=extra_body, # explicit kwarg**api_params, # may also contain extra_body if user passed it
)
_make_backend_specific_and_remove() treats extra_body as a valid Completions.create parameter and passes it through into api_params. When both the explicit kwarg and **api_params contain extra_body, Python raises TypeError at call time.
Standard path fix (reference)
PR #1204 fixed the identical bug in _generate_from_chat_context_standard() by popping extra_body out of backend_specific before spreading, then deep-merging it into extra_params["extra_body"] (preserving chat_template_kwargs separately). The intrinsic path needs the same treatment.
Mirror the standard-path fix from PR #1204: pop extra_body from the result of _make_backend_specific_and_remove() before api_params.update(...), then merge it into the existing extra_body dict (deep-merging chat_template_kwargs as the only nested key either side writes).
I wanted to link a related use-case to this issue.
The collision fix in PR #1204 (and the equivalent fix needed for the intrinsic path described here) handles the case where a caller passes extra_body in model_options. That's important and we hit it too.
But there's a second, complementary need: passing extra_body fields at construction time, not per-call — specifically chat_template_kwargs for vLLM Granite models that control thinking tiers (enable_thinking, low_effort). These flags are request-scoped but constant for a given MelleaSession, so construction-time injection is cleaner than per-call.
AsyncOpenAI doesn't support default_extra_body, so Mellea would need to add its own equivalent on OpenAIBackend. We filed this as a separate feature request at #1453. Flagging here so the two issues can be considered together — the #1241 collision fix and the #1453 construction-time feature are complementary halves of the same problem.
Activity
refactor(backends): extract _merge_user_extra_body helper
fix(backends): merge intrinsic extra_body once (generative-computing#…
planetf1 commentedon Aug 5, 2026
I wanted to link a related use-case to this issue.
The collision fix in PR #1204 (and the equivalent fix needed for the intrinsic path described here) handles the case where a caller passes
extra_bodyinmodel_options. That's important and we hit it too.But there's a second, complementary need: passing
extra_bodyfields at construction time, not per-call — specificallychat_template_kwargsfor vLLM Granite models that control thinking tiers (enable_thinking,low_effort). These flags are request-scoped but constant for a givenMelleaSession, so construction-time injection is cleaner than per-call.AsyncOpenAIdoesn't supportdefault_extra_body, so Mellea would need to add its own equivalent onOpenAIBackend. We filed this as a separate feature request at #1453. Flagging here so the two issues can be considered together — the #1241 collision fix and the #1453 construction-time feature are complementary halves of the same problem.