User Settings
The User model stores preferences in a user_settings JSONB column, including LLM defaults, UI preferences, notifications, and localization settings.
Schema Structure
Usage
Access settings via the user.settings property, which provides type-safe access to all preferences:
API Endpoints
Validation
Settings are validated using Pydantic schemas in rhesis.backend.app.schemas.user:
- LLMModelSettings: Temperature (0.0-2.0), max_tokens (>0)
- UISettings: Theme choices, page size (1-100)
- NotificationSettings: Boolean preferences
Best Practices
- Access settings via
user.settingsproperty, not the rawuser_settingsdictionary - Handle
Nonevalues - properties returnNonefor missing settings - Use
user.settings.update()for deep merge updates - Remember to persist:
user.user_settings = user.settings.rawand commit - Provide sensible defaults when settings are unspecified