Preferences
Overview
The Model Preferences system allows per-chat model selection for agents with persistent storage in PostgreSQL. This enables dynamic model switching and preference management at runtime.
Implementation
Model Types
Service Interface
Database Schema
Usage
Getting Model Preference
Setting Model Preference
Removing Model Preference
Error Handling
The service implements graceful error handling:
Returns
null
when no preference existsReturns
false
for failed operationsThrows typed errors for database failures
Validates input parameters
Best Practices
Data Access
Use prepared statements
Implement connection pooling
Handle concurrent updates
Validate input parameters
Performance
Leverage database indexes
Cache frequent lookups
Batch operations when possible
Monitor query performance
Related Documentation
Last updated