Skip to content

Latest commit

 

History

History
206 lines (146 loc) · 7.89 KB

File metadata and controls

206 lines (146 loc) · 7.89 KB
title Model Registry
description Model Registry protocol schemas

{/* ⚠️ AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs live in the module folders under content/docs/. */}

AI Model Registry Protocol

Centralized registry for managing AI models, prompt templates, and model versioning.

Enables AI-powered ObjectStack applications to discover and use LLMs consistently.

**Source:** `packages/spec/src/ai/model-registry.zod.ts`

TypeScript Usage

import { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistry, ModelRegistryEntry, ModelSelectionCriteria, PromptTemplate, PromptVariable } from '@objectstack/spec/ai';
import type { ModelCapability, ModelConfig, ModelLimits, ModelPricing, ModelProvider, ModelRegistry, ModelRegistryEntry, ModelSelectionCriteria, PromptTemplate, PromptVariable } from '@objectstack/spec/ai';

// Validate data
const result = ModelCapability.parse(data);

ModelCapability

Properties

Property Type Required Description
textGeneration boolean Supports text generation
textEmbedding boolean Supports text embedding
imageGeneration boolean Supports image generation
imageUnderstanding boolean Supports image understanding
functionCalling boolean Supports function calling
codeGeneration boolean Supports code generation
reasoning boolean Supports advanced reasoning

ModelConfig

Properties

Property Type Required Description
id string Unique model identifier
name string Model display name
version string Model version (e.g., "gpt-4-turbo-2024-04-09")
provider Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>
capabilities { textGeneration: boolean; textEmbedding: boolean; imageGeneration: boolean; imageUnderstanding: boolean; … }
limits { maxTokens: integer; contextWindow: integer; maxOutputTokens?: integer; rateLimit?: object }
pricing { currency: string; inputCostPer1kTokens?: number; outputCostPer1kTokens?: number; embeddingCostPer1kTokens?: number } optional
endpoint string optional Custom API endpoint
apiKey string optional API key (Warning: Prefer secretRef)
secretRef string optional Reference to stored secret (e.g. system:openai_api_key)
region string optional Deployment region (e.g., "us-east-1")
description string optional
tags string[] optional Tags for categorization
deprecated boolean
recommendedFor string[] optional Use case recommendations

ModelLimits

Properties

Property Type Required Description
maxTokens integer Maximum tokens per request
contextWindow integer Context window size
maxOutputTokens integer optional Maximum output tokens
rateLimit { requestsPerMinute?: integer; tokensPerMinute?: integer } optional

ModelPricing

Properties

Property Type Required Description
currency string
inputCostPer1kTokens number optional Cost per 1K input tokens
outputCostPer1kTokens number optional Cost per 1K output tokens
embeddingCostPer1kTokens number optional Cost per 1K embedding tokens

ModelProvider

Allowed Values

  • openai
  • azure_openai
  • anthropic
  • google
  • cohere
  • huggingface
  • local
  • custom

ModelRegistry

Properties

Property Type Required Description
name string Registry name
models Record<string, { model: object; status?: Enum<'active' | 'deprecated' | 'experimental' | 'disabled'>; priority?: integer; fallbackModels?: string[]; … }> Model entries by ID
promptTemplates Record<string, { id: string; name: string; label: string; system?: string | { dialect: Enum<'cel' | 'cron' | 'template'>; source?: string; ast?: any; meta?: object }; … }> optional Prompt templates by name
defaultModel string optional Default model ID
enableAutoFallback boolean optional Auto-fallback on errors

ModelRegistryEntry

Properties

Property Type Required Description
model { id: string; name: string; version: string; provider: Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'>; … }
status Enum<'active' | 'deprecated' | 'experimental' | 'disabled'>
priority integer Priority for model selection
fallbackModels string[] optional Fallback model IDs
healthCheck { enabled: boolean; intervalSeconds: integer; lastChecked?: string; status: Enum<'healthy' | 'unhealthy' | 'unknown'> } optional

ModelSelectionCriteria

Properties

Property Type Required Description
capabilities string[] optional Required capabilities
maxCostPer1kTokens number optional Maximum acceptable cost
minContextWindow number optional Minimum context window size
provider Enum<'openai' | 'azure_openai' | 'anthropic' | 'google' | 'cohere' | 'huggingface' | 'local' | 'custom'> optional
tags string[] optional
excludeDeprecated boolean

PromptTemplate

Properties

Property Type Required Description
id string Unique template identifier
name string Template name (snake_case)
label string Display name
system string | { dialect: Enum<'cel' | 'cron' | 'template'>; source?: string; ast?: any; meta?: object } optional System prompt — supports {{var}} interpolation
user string | { dialect: Enum<'cel' | 'cron' | 'template'>; source?: string; ast?: any; meta?: object } User prompt template — supports {{var}} interpolation
assistant string optional Assistant message prefix
variables { name: string; type?: Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>; required?: boolean; defaultValue?: any; … }[] optional Template variables
modelId string optional Recommended model ID
temperature number optional
maxTokens number optional
topP number optional
frequencyPenalty number optional
presencePenalty number optional
stopSequences string[] optional
version string optional
description string optional
category string optional Template category (e.g., "code_generation", "support")
tags string[] optional
examples { input: Record<string, any>; output: string }[] optional

PromptVariable

Properties

Property Type Required Description
name string Variable name (e.g., "user_name", "context")
type Enum<'string' | 'number' | 'boolean' | 'object' | 'array'>
required boolean
defaultValue any optional
description string optional
validation { minLength?: number; maxLength?: number; pattern?: string; enum?: any[] } optional