@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
29 lines (28 loc) • 1.39 kB
TypeScript
/**
* Shared type utilities for AI SDK provider integration.
*
* Provides type-safe helpers to bridge between the AI SDK's generic types
* and NeuroLink's internal type system without resorting to `as any` casts.
*/
import type { LanguageModel, streamText } from "ai";
import type { StreamTextResult } 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: ReturnType<typeof streamText>): StreamTextResult;