1.0.0 • Published 6 months ago

@bluefly/model-registry v1.0.0

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
6 months ago

Model Registry Component

NPM version License: MIT

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-registry

Usage

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 class
  • onModelSelect?: (model: LlmModel) => void - Called when a model is selected
  • onModelCreate?: (model: LlmModel) => void - Called when a model is created
  • onModelUpdate?: (model: LlmModel) => void - Called when a model is updated
  • onModelDelete?: (modelId: string) => void - Called when a model is deleted
  • showActions?: boolean - Whether to show action buttons
  • searchable?: boolean - Enable search functionality
  • filterable?: boolean - Enable filtering
  • pageSize?: 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 handler
  • onCancel: () => void - Cancel handler
  • loading?: boolean - Loading state
  • error?: string - Error message

<ModelStandardsValidator>

Component that validates models against standards.

Props:

  • model?: LlmModel | ModelCreateRequest | ModelUpdateRequest - Model to validate
  • onChange?: (isValid: boolean, results: ValidationResult) => void - Validation result handler
  • showWarnings?: boolean - Whether to display warnings

Utility Functions

  • validateModelStandards(model) - Validate a model against standards
  • applyModelStandards(model) - Apply standards to fix model issues
  • generateModelStandardsConfig(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.8

The component uses @bluefly/reelcode for standards validation.

License

MIT © Bluefly Engineering