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

39 lines (38 loc) • 1.94 kB
/** * The realtime model factory: builds the LiveKit speech-to-speech model for the * configured backend. * * `gemini` is Gemini Live on Vertex through `@livekit/agents-plugin-google`; * `xai` is Grok Voice through `@livekit/agents-plugin-xai`, which speaks the * OpenAI realtime protocol to `wss://api.x.ai/v1`. Both plugins and * `@google/genai` are imported dynamically so the core package does not require * them unless the realtime agent is used. * * The xai backend was run against the real xAI service on 2026-10-20; what that * showed, and what is still unmeasured, is in the document below. * * See docs/features/livekit-voice-agent.md. */ import type { RealtimeLlm, RealtimeVoiceConfig } from "../../types/index.js"; /** * Fail early, naming the variable, when `XAI_API_KEY` is blank or absent. * * The plugin reads the key itself and falls back to `OPENAI_API_KEY` when its * own is missing, which would send an OpenAI key to the xAI host, so a missing * key must stop here. The message never carries a value. */ export declare function requireXaiApiKey(): void; /** * Build the realtime model for `cfg.backend`. * * The gemini branch builds exactly what the agent has always built: Vertex AI, * the configured model, transcripts of both sides, and project, location, * voice and modality when set. The xai branch needs `XAI_API_KEY` in the * environment and throws before touching the plugin when it is missing. It then * checks `xaiBaseURL` as config resolution does, and throws before touching the * plugin for a value that is not a `ws://` or `wss://` URL, and for a `ws://` * URL to a host other than localhost, 127.0.0.0/8 or [::1] unless * `XAI_REALTIME_ALLOW_INSECURE=true`. That opt-in never admits a value that is * not a ws or wss URL. The errors name `xaiBaseURL` and do not repeat the value. */ export declare function createRealtimeLlm(cfg: RealtimeVoiceConfig): Promise<RealtimeLlm>;