UNPKG

@juspay/neurolink

Version:

The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002

105 lines (104 loc) • 4.42 kB
/** * Centralized model choices for CLI commands * Derives choices from model enums to ensure consistency */ import { AIProviderName } from "../constants/enums.js"; import type { CatalogProviderName, ModelChoice } from "../types/index.js"; /** * Default models per provider (first choice/recommended). * * Covers every provider EXCEPT the JSON-catalog providers (see * `CatalogProviderName`) — those default models come from `models.default` * in the catalog JSON, read directly by `getDefaultModel()` below. (cerebras, * sambanova — never had a hand entry here at all; `getDefaultModel()` now * resolves them too.) * * AUTO is also excluded — it never had an entry here either (matches * pre-existing behavior: `getDefaultModel(AUTO)` returns `undefined`). */ export declare const DEFAULT_MODELS: Record<Exclude<AIProviderName, CatalogProviderName | AIProviderName.AUTO>, string>; /** * Get top model choices for a provider (for CLI prompts) * Returns models formatted for inquirer list prompts * * @param provider - The AI provider to get models for * @param limit - Maximum number of models to return (default: 5) * @returns Array of ModelChoice objects for CLI prompts */ export declare function getTopModelChoices(provider: AIProviderName, limit?: number): ModelChoice[]; /** * Get all available models for a provider * Returns all values from the provider's model enum * * For a JSON-catalog provider, excludes retired ids. The `catalog` map keeps * retired entries as raw table keys (they still resolve for a caller who * pins that id explicitly — see `isValidModel`'s dedicated retired-id * allowance below), but a listing/selection surface should not offer them. * Mirrors the `selectableModels` filter in catalog/schema.ts. * * @param provider - The AI provider to get models for * @returns Array of model identifier strings */ export declare function getAllModels(provider: AIProviderName): string[]; /** * Get available provider choices for CLI * Returns all provider names except AUTO * * @returns Array of provider name strings */ export declare function getProviderChoices(): string[]; /** * Get all provider choices including AUTO * * @returns Array of all provider name strings */ export declare function getAllProviderChoices(): string[]; /** * Get the default model for a provider * * @param provider - The AI provider * @returns Default model string for the provider */ export declare function getDefaultModel(provider: AIProviderName): string | undefined; /** * Check if a model is valid for a given provider * * `getAllModels` excludes retired catalog ids (it is a listing/selection * surface), but a caller who pins a retired id explicitly must not have * that pin start failing validation just because it dropped out of the * listing — so this falls back to the full catalog (all statuses) before * rejecting a JSON-catalog provider's model. * * The empty-listing case is checked against catalog membership, not * accepted outright: a catalog provider whose every entry happens to be * retired still has a real catalog to validate against, and a fabricated * id must not slip through just because the *selectable* listing is empty. * Only a provider with no catalog entry at all (openai-compatible, * lm-studio, llamacpp — providers without a strict model list) keeps the * permissive "allow any model" behavior. * * @param provider - The AI provider * @param model - The model identifier to check * @returns true if the model exists in the provider's model enum */ export declare function isValidModel(provider: AIProviderName, model: string): boolean; /** * Get model choices formatted for inquirer prompts with a specific default * * @param provider - The AI provider * @param currentModel - Current/existing model to mark as default * @param limit - Maximum number of models to return * @returns Array of ModelChoice objects with the current model marked */ export declare function getModelChoicesWithDefault(provider: AIProviderName, currentModel?: string, limit?: number): ModelChoice[]; /** * Get a flat list of popular models across all providers * Useful for model suggestions and auto-complete * * @returns Array of { provider, model, description } objects */ export declare function getPopularModelsAcrossProviders(): { provider: AIProviderName; model: string; description: string; }[];