MCPcopy
hub / github.com/jundot/omlx / set_settings

Method set_settings

omlx/model_settings.py:372–397  ·  view source on GitHub ↗

Set settings for a specific model. If the new settings have is_default=True, clears is_default from all other models to maintain the exclusive default constraint. Args: model_id: The model identifier. settings: The settings to apply.

(self, model_id: str, settings: ModelSettings)

Source from the content-addressed store, hash-verified

370 return ModelSettings()
371
372 def set_settings(self, model_id: str, settings: ModelSettings) -> None:
373 """Set settings for a specific model.
374
375 If the new settings have is_default=True, clears is_default from all
376 other models to maintain the exclusive default constraint.
377
378 Args:
379 model_id: The model identifier.
380 settings: The settings to apply.
381 """
382 with self._lock:
383 # Handle exclusive default constraint
384 if settings.is_default:
385 for mid, s in self._settings.items():
386 if mid != model_id and s.is_default:
387 s.is_default = False
388 logger.info(
389 f"Cleared is_default from model '{mid}' "
390 f"(new default: '{model_id}')"
391 )
392
393 # Store a copy of the settings
394 self._settings[model_id] = ModelSettings.from_dict(settings.to_dict())
395 logger.info(f"Updated settings for model '{model_id}'")
396
397 self._save()
398
399 def delete_settings(self, model_id: str) -> bool:
400 """Remove all persisted state for a model (settings + profiles).

Calls 4

_saveMethod · 0.95
itemsMethod · 0.45
from_dictMethod · 0.45
to_dictMethod · 0.45