Preferences
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.
Model Types
export type ModelType = 'OPENAI' | 'GEMINI' | 'GROK' | 'DEEPSEEK';Service Interface
class ModelPreferencesService {
static async getModelPreference(
agentId: string,
chatId: number
): Promise<ModelType | null>;
static async setModelPreference(
agentId: string,
chatId: number,
modelType: ModelType
): Promise<boolean>;
static async deleteModelPreference(
agentId: string,
chatId: number
): Promise<boolean>;
}Database Schema
Usage
Getting Model Preference
Setting Model Preference
Removing Model Preference
Error Handling
Best Practices
Data Access
Performance
Related Documentation
Last updated