Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions concordia/components/game_master/world_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down
12 changes: 9 additions & 3 deletions concordia/contrib/language_models/openai/base_gpt_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading