1.0.0 • Published 6 months ago
@bluefly/model-registry v1.0.0
Model Registry Component
A comprehensive Model Registry component for managing LLM models with built-in validation against standards.
Features
- 📋 Model Management: Create, update, and manage LLM model configurations
- ✅ Standards Validation: Validate models against predefined standards
- 🔧 Auto-Fix: Automatically fix common configuration issues
- 🔄 Environment-Specific Rules: Different validation rules for different environments
- 🏷️ Provider-Specific Rules: Custom validation for different model providers
Installation
npm install @bluefly/model-registryUsage
Basic Model Registry
import { ModelRegistry } from '@bluefly/model-registry';
function App() {
return (
<div className="app">
<ModelRegistry
onModelSelect={handleModelSelect}
showActions={true}
searchable={true}
filterable={true}
/>
</div>
);
}Model Form with Validation
import { ModelForm } from '@bluefly/model-registry';
function CreateModel() {
const handleSubmit = (data) => {
console.log('Model data:', data);
// Submit to API
};
return (
<div className="create-model">
<h1>Create New Model</h1>
<ModelForm
onSubmit={handleSubmit}
onCancel={() => navigate(-1)}
/>
</div>
);
}Standalone Model Validation
import { validateModelStandards } from '@bluefly/model-registry';
async function validateModel(model) {
const result = await validateModelStandards(model);
if (result.valid) {
console.log('Model is valid!');
} else {
console.log('Validation errors:', result.errors);
console.log('Warnings:', result.warnings);
}
}Component API
<ModelRegistry>
Main component for displaying and managing models.
Props:
className?: string- Additional CSS classonModelSelect?: (model: LlmModel) => void- Called when a model is selectedonModelCreate?: (model: LlmModel) => void- Called when a model is createdonModelUpdate?: (model: LlmModel) => void- Called when a model is updatedonModelDelete?: (modelId: string) => void- Called when a model is deletedshowActions?: boolean- Whether to show action buttonssearchable?: boolean- Enable search functionalityfilterable?: boolean- Enable filteringpageSize?: number- Number of models per page
<ModelForm>
Form component for creating and editing models.
Props:
model?: LlmModel- Model data for editing (omit for create mode)onSubmit: (data: ModelCreateRequest | ModelUpdateRequest) => void- Submit handleronCancel: () => void- Cancel handlerloading?: boolean- Loading stateerror?: string- Error message
<ModelStandardsValidator>
Component that validates models against standards.
Props:
model?: LlmModel | ModelCreateRequest | ModelUpdateRequest- Model to validateonChange?: (isValid: boolean, results: ValidationResult) => void- Validation result handlershowWarnings?: boolean- Whether to display warnings
Utility Functions
validateModelStandards(model)- Validate a model against standardsapplyModelStandards(model)- Apply standards to fix model issuesgenerateModelStandardsConfig(projectId)- Generate standards configuration for AI assistants
Standards Configuration
Model validation rules are defined in YAML format:
rules:
naming:
model_name:
pattern: "^[a-zA-Z0-9\\-_]+$"
min_length: 3
max_length: 100
versioning:
pattern: "^\\d+\\.\\d+\\.\\d+(?:-[a-zA-Z0-9\\-\\.]+)?(?:\\+[a-zA-Z0-9\\-\\.]+)?$"
parameters:
temperature:
min: 0
max: 1
recommended_max: 0.8The component uses @bluefly/reelcode for standards validation.
License
MIT © Bluefly Engineering
1.0.0
6 months ago