Files
reason-flow/server/models/ModelVersion.js
T
2025-11-06 11:08:59 +01:00

73 lines
1.6 KiB
JavaScript

module.exports = (sequelize, DataTypes) => {
const ModelVersion = sequelize.define('ModelVersion', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
model_name: {
type: DataTypes.STRING,
allowNull: false
},
version: {
type: DataTypes.STRING,
allowNull: false
},
model_type: {
type: DataTypes.ENUM('MODEL1', 'QUERYMODEL'),
allowNull: false
},
base_model: {
type: DataTypes.STRING,
allowNull: false
},
fine_tuning_method: {
type: DataTypes.ENUM('SFT', 'DPO', 'PPO', 'LoRA', 'QLoRA'),
allowNull: true
},
training_data_count: {
type: DataTypes.INTEGER,
defaultValue: 0
},
performance_metrics: {
type: DataTypes.JSONB,
defaultValue: {}
},
is_active: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
deployment_status: {
type: DataTypes.ENUM('training', 'testing', 'deployed', 'deprecated'),
defaultValue: 'training'
},
model_path: {
type: DataTypes.STRING,
allowNull: true
},
hyperparameters: {
type: DataTypes.JSONB,
defaultValue: {}
},
training_log: {
type: DataTypes.JSONB,
defaultValue: {}
},
metadata: {
type: DataTypes.JSONB,
defaultValue: {}
}
}, {
tableName: 'model_versions',
indexes: [
{ fields: ['model_name'] },
{ fields: ['model_type'] },
{ fields: ['is_active'] },
{ fields: ['deployment_status'] },
{ fields: ['created_at'] }
]
});
return ModelVersion;
};