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

23 lines (22 loc) • 1.19 kB
import type { StreamTextResult } from "../types/index.js"; import type { LanguageModel } from "../types/index.js"; /** * Extract the model identifier from a LanguageModel value. * * `LanguageModel` in AI SDK v6 is `string | LanguageModelV2 | LanguageModelV3`. * When it's a string it IS the model ID; when it's an object, `.modelId` holds it. * * @param model - The LanguageModel value (string or object). * @param fallback - Value returned when the model ID cannot be determined. */ export declare function getModelId(model: LanguageModel, fallback?: string): string; /** * Adapt an AI SDK `StreamTextResult` (generic, parameterised by TOOLS & OUTPUT) * to the simpler NeuroLink `StreamTextResult` expected by the analytics collector. * * The AI SDK result is a structural superset of our local type — every field our * analytics code reads (`textStream`, `text`, `usage`, `response`, `finishReason`, * `toolResults`, `toolCalls`) exists on the SDK result with compatible types. * This function performs the structural down-cast without `as any`. */ export declare function toAnalyticsStreamResult(result: StreamTextResult | Record<string, unknown>): StreamTextResult;