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

36 lines (35 loc) • 1.59 kB
/** * KnowledgeGroundingEngine — the provider-neutral orchestrator. * * Loads the source set once at construction, reuses the process-level * in-memory index cache when possible, and runs one retrieval + context * assembly per eligible turn. The engine's snapshot is never reset after * construction — sources are supplied only via the constructor config. * * The engine never throws from `ground()` — any failure fails open to "no * grounding" with a `failureReason`, so an informational turn is never broken. * It performs no logging and no telemetry itself; the client wiring reads * `getStatus()`/the outcome metadata and emits spans. */ import type { KnowledgeEngineStatus, KnowledgeGroundingConfig, KnowledgeGroundingInput, KnowledgeGroundingOutcome } from "../types/index.js"; export declare class KnowledgeGroundingEngine { private readonly config; private readonly resolved; private snapshot; private buildPromise; private lastError; private validationIssues; private readonly now; constructor(config: KnowledgeGroundingConfig, now?: () => number); isEnabled(): boolean; /** Resolve once the one-time build settles. Safe to call before every turn. */ ready(): Promise<void>; getStatus(): KnowledgeEngineStatus; private build; private buildRequest; /** * Retrieve + assemble for one turn. Returns the ephemeral context to inject * (or null), aggregate metadata, and the full retrieval. Never throws. */ ground(input: KnowledgeGroundingInput): Promise<KnowledgeGroundingOutcome>; }