@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and
221 lines (220 loc) • 6.13 kB
TypeScript
import { z } from "zod";
/**
* Model configuration schema for validation
*/
declare const ModelConfigSchema: z.ZodObject<{
id: z.ZodString;
displayName: z.ZodString;
capabilities: z.ZodArray<z.ZodString, "many">;
deprecated: z.ZodBoolean;
pricing: z.ZodObject<{
input: z.ZodNumber;
output: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
input: number;
output: number;
}, {
input: number;
output: number;
}>;
contextWindow: z.ZodNumber;
releaseDate: z.ZodString;
}, "strip", z.ZodTypeAny, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}>;
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, "many">;
deprecated: z.ZodBoolean;
pricing: z.ZodObject<{
input: z.ZodNumber;
output: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
input: number;
output: number;
}, {
input: number;
output: number;
}>;
contextWindow: z.ZodNumber;
releaseDate: z.ZodString;
}, "strip", z.ZodTypeAny, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}>>>;
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
defaults: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, "strip", z.ZodTypeAny, {
models: Record<string, Record<string, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}>>;
version: string;
lastUpdated: string;
defaults?: Record<string, string> | undefined;
aliases?: Record<string, string> | undefined;
}, {
models: Record<string, Record<string, {
capabilities: string[];
id: string;
deprecated: boolean;
displayName: string;
pricing: {
input: number;
output: number;
};
contextWindow: number;
releaseDate: string;
}>>;
version: string;
lastUpdated: string;
defaults?: Record<string, string> | undefined;
aliases?: Record<string, string> | undefined;
}>;
export type ModelConfig = z.infer<typeof ModelConfigSchema>;
export type ModelRegistry = z.infer<typeof ModelRegistrySchema>;
/**
* Dynamic Model Provider
* Loads and manages model configurations from external sources
*/
export declare class DynamicModelProvider {
private static instance;
private modelRegistry;
private lastFetch;
private readonly CACHE_DURATION;
private constructor();
static getInstance(): DynamicModelProvider;
/**
* Initialize the model registry from multiple sources with timeout handling
* Addresses hanging issues when localhost:3001 is not running or GitHub URLs timeout
*/
initialize(): Promise<void>;
/**
* Load configuration from a source with timeout handling
* Prevents hanging when local servers are down or network requests timeout
*/
private loadFromSourceWithTimeout;
/**
* Quick health check for localhost endpoints
* Prevents hanging on non-responsive local servers
*/
private healthCheckLocalhost;
/**
* Load configuration from a source (URL or file path) - Legacy method for compatibility
* @deprecated Use loadFromSourceWithTimeout instead
*/
private loadFromSource;
/**
* Get all available models for a provider
*/
getModelsForProvider(provider: string): Record<string, ModelConfig>;
/**
* Resolve a model by provider and model hint
*/
resolveModel(provider: string, modelHint?: string): ModelConfig | null;
/**
* Search models by capabilities
*/
searchByCapability(capability: string, options?: {
provider?: string;
maxPrice?: number;
excludeDeprecated?: boolean;
}): Array<{
provider: string;
model: string;
config: ModelConfig;
}>;
/**
* Get the best model for a specific use case
*/
getBestModelFor(useCase: "coding" | "analysis" | "vision" | "fastest" | "cheapest"): {
provider: string;
model: string;
config: ModelConfig;
} | null;
/**
* Get all models across all providers
*/
getAllModels(): Array<{
provider: string;
model: string;
config: ModelConfig;
}>;
/**
* Get total number of models
*/
getTotalModelCount(): number;
/**
* Check if cache needs refresh
*/
needsRefresh(): boolean;
/**
* Force refresh the model registry
*/
refresh(): Promise<void>;
/**
* Ensure the registry is initialized
*/
private ensureInitialized;
/**
* Get registry metadata
*/
getMetadata(): {
version: string;
lastUpdated: string;
modelCount: number;
} | null;
}
export declare const dynamicModelProvider: DynamicModelProvider;
export {};