UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

258 lines (257 loc) 7.05 kB
/** * Model-related type definitions for NeuroLink * Consolidates all model configuration, dynamic model, and provider model types */ import { z } from "zod"; import type { JsonValue } from "./common.js"; import { AIProviderName } from "../constants/enums.js"; import type { TaskType } from "./taskClassification.js"; /** * Model performance tier definition */ export type ModelTier = "fast" | "balanced" | "quality"; /** * Model configuration source type */ export type ConfigSource = "default" | "environment" | "file" | "dynamic"; /** * Model configuration for a specific provider */ export type ModelConfig = { /** Model identifier */ id: string; /** Display name */ name: string; /** Performance tier */ tier: ModelTier; /** Cost per 1K tokens */ cost: { input: number; output: number; }; /** Model capabilities */ capabilities: string[]; /** Model-specific options */ options?: Record<string, JsonValue>; }; /** * Provider configuration for model management */ export type ProviderConfiguration = { /** Provider name */ provider: string; /** Available models by tier */ models: Record<ModelTier, string>; /** Default cost per token (fallback) */ defaultCost: { input: number; output: number; }; /** Required environment variables */ requiredEnvVars: string[]; /** Provider-specific performance metrics */ performance: { speed: number; quality: number; cost: number; }; /** Provider-specific model configurations */ modelConfigs?: Record<string, ModelConfig>; /** Provider-specific model behavior configurations */ modelBehavior?: { /** Models that have issues with maxTokens parameter */ maxTokensIssues?: string[]; /** Models that require special handling */ specialHandling?: Record<string, JsonValue>; /** Models that support tool calling (Ollama-specific) */ toolCapableModels?: string[]; }; }; /** * Zod schema for model configuration validation */ export declare const ModelConfigSchema: z.ZodObject<{ id: z.ZodString; displayName: z.ZodString; capabilities: z.ZodArray<z.ZodString>; deprecated: z.ZodBoolean; pricing: z.ZodObject<{ input: z.ZodNumber; output: z.ZodNumber; }, z.core.$strip>; contextWindow: z.ZodNumber; releaseDate: z.ZodString; }, z.core.$strip>; /** * Zod schema for model registry validation */ export declare const ModelRegistrySchema: z.ZodObject<{ version: z.ZodString; lastUpdated: z.ZodString; models: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodObject<{ id: z.ZodString; displayName: z.ZodString; capabilities: z.ZodArray<z.ZodString>; deprecated: z.ZodBoolean; pricing: z.ZodObject<{ input: z.ZodNumber; output: z.ZodNumber; }, z.core.$strip>; contextWindow: z.ZodNumber; releaseDate: z.ZodString; }, z.core.$strip>>>; aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; }, z.core.$strip>; /** * Dynamic model configuration type */ export type DynamicModelConfig = z.infer<typeof ModelConfigSchema>; /** * Dynamic model registry type */ export type ModelRegistry = z.infer<typeof ModelRegistrySchema>; /** * Model capabilities interface */ export type ModelCapabilities = { vision: boolean; functionCalling: boolean; codeGeneration: boolean; reasoning: boolean; multimodal: boolean; streaming: boolean; jsonMode: boolean; }; /** * Model pricing information */ export type ModelPricingInfo = { inputCostPer1K: number; outputCostPer1K: number; currency: string; }; /** * Model performance characteristics */ export type ModelPerformance = { speed: "fast" | "medium" | "slow"; quality: "high" | "medium" | "low"; accuracy: "high" | "medium" | "low"; }; /** * Model limitations and constraints */ export type ModelLimits = { maxContextTokens: number; maxOutputTokens: number; maxRequestsPerMinute?: number; maxRequestsPerDay?: number; }; /** * Use case suitability scores (1-10 scale) */ export type UseCaseSuitability = { coding: number; creative: number; analysis: number; conversation: number; reasoning: number; translation: number; summarization: number; }; /** * Complete model information */ export type ModelInfo = { id: string; name: string; provider: AIProviderName; description: string; capabilities: ModelCapabilities; pricing: ModelPricingInfo; performance: ModelPerformance; limits: ModelLimits; useCases: UseCaseSuitability; aliases: string[]; deprecated: boolean; isLocal: boolean; releaseDate?: string; category: "general" | "coding" | "creative" | "vision" | "reasoning"; }; /** * Model search filters */ export type ModelSearchFilters = { provider?: AIProviderName | AIProviderName[]; capability?: keyof ModelCapabilities | (keyof ModelCapabilities)[]; useCase?: keyof UseCaseSuitability; maxCost?: number; minContextSize?: number; maxContextSize?: number; performance?: ModelPerformance["speed"] | ModelPerformance["quality"]; category?: ModelInfo["category"] | ModelInfo["category"][]; }; /** * Model search result with ranking */ export type ModelSearchResult = { model: ModelInfo; score: number; matchReasons: string[]; }; /** * Model recommendation context */ export type RecommendationContext = { useCase?: keyof UseCaseSuitability; maxCost?: number; minQuality?: "low" | "medium" | "high"; requireCapabilities?: (keyof ModelCapabilities)[]; excludeProviders?: AIProviderName[]; contextSize?: number; preferLocal?: boolean; }; /** * Model recommendation result */ export type ModelRecommendation = { model: ModelInfo; score: number; reasoning: string[]; alternatives: ModelInfo[]; }; /** * Model comparison result */ export type ModelComparison = { models: ModelInfo[]; comparison: { capabilities: Record<keyof ModelCapabilities, ModelInfo[]>; pricing: { cheapest: ModelInfo; mostExpensive: ModelInfo; }; performance: Record<string, ModelInfo[]>; contextSize: { largest: ModelInfo; smallest: ModelInfo; }; }; }; export type ModelRoute = { provider: string; model: string; reasoning: string; confidence: number; }; export type ModelRoutingOptions = { /** Override the task classification */ forceTaskType?: TaskType; /** Require specific performance characteristics */ requireFast?: boolean; /** Require specific capability (reasoning, creativity, etc.) */ requireCapability?: string; /** Fallback strategy if primary choice fails */ fallbackStrategy?: "fast" | "reasoning" | "auto"; };