From 5bda291c540fbf5667140b517424dddbafa78022 Mon Sep 17 00:00:00 2001 From: Greg Rehm Date: Sun, 12 Apr 2026 12:46:07 -0700 Subject: [PATCH 1/2] Fix OpenAI model compatibility for reasoning_effort and verbosity params The `reasoning_effort` and `verbosity` parameters are only supported by reasoning models (o-series, GPT-5 family). Passing them to non-reasoning models like gpt-4o-mini causes a 400 BadRequestError: "Unrecognized request argument supplied: reasoning_effort" Per OpenAI's documentation, gpt-4o-mini is not a reasoning model and does not support reasoning_effort. The parameter is documented as being for reasoning models only (o1, o3, o4-mini, gpt-5, etc.). Ref: https://developers.openai.com/docs/guides/reasoning Ref: https://developers.openai.com/docs/models/gpt-4o-mini This change conditionally includes reasoning_effort and verbosity only when the model name indicates a reasoning model. --- .../contrib/language_models/openai/base_gpt_model.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/concordia/contrib/language_models/openai/base_gpt_model.py b/concordia/contrib/language_models/openai/base_gpt_model.py index b90e3db9e..109f009a3 100644 --- a/concordia/contrib/language_models/openai/base_gpt_model.py +++ b/concordia/contrib/language_models/openai/base_gpt_model.py @@ -90,16 +90,22 @@ def _sample_text( {'role': 'user', 'content': prompt}, ] - response = self._client.chat.completions.create( + kwargs = dict( model=self._model_name, messages=messages, temperature=temperature, max_completion_tokens=max_tokens, timeout=timeout, seed=seed, - reasoning_effort=reasoning_effort, - verbosity=verbosity, ) + # reasoning_effort and verbosity are only supported by reasoning + # models (o-series, GPT-5). Skip for others to avoid 400 errors. + _REASONING_PREFIXES = ('o1', 'o3', 'o4', 'gpt-5') + if any(self._model_name.startswith(p) for p in _REASONING_PREFIXES): + kwargs['reasoning_effort'] = reasoning_effort + kwargs['verbosity'] = verbosity + + response = self._client.chat.completions.create(**kwargs) if self._measurements is not None: self._measurements.publish_datum( From f898ce5fb099abcc87876a509177abb9ccaf0b8b Mon Sep 17 00:00:00 2001 From: Greg Rehm Date: Sun, 12 Apr 2026 16:54:31 -0700 Subject: [PATCH 2/2] Fix pylint errors in world_state.py for type narrowing Pylint does not narrow `self._valid_locations` after a None guard on the instance attribute. Assigning to a local variable after the check lets pylint infer the correct non-None type. --- concordia/components/game_master/world_state.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/concordia/components/game_master/world_state.py b/concordia/components/game_master/world_state.py index d94b7e0ef..5204b80fe 100644 --- a/concordia/components/game_master/world_state.py +++ b/concordia/components/game_master/world_state.py @@ -292,13 +292,14 @@ def _normalize_location(self, location: str) -> str: location = location.strip().rstrip('.') if self._valid_locations is None: return location - if location in self._valid_locations: + valid_locations = self._valid_locations + if location in valid_locations: return location location_lower = location.lower() - for valid in self._valid_locations: + for valid in valid_locations: if valid.lower() == location_lower: return valid - for valid in self._valid_locations: + for valid in valid_locations: if valid.lower() in location_lower: return valid return ''