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

22 lines (21 loc) • 1.08 kB
/** * Response Validator * * Standalone utility for validating and optionally mutating LLM response text. * Handles length checks (including truncation), phrase checks, JSON schema * validation, and custom validators. Returns a structured result telling the * caller whether to continue, abort, or retry — the caller owns the retry loop. * * No async I/O, no telemetry spans, no processor classes. */ import type { ResponseValidationConfig, ResponseValidationResult } from "../types/index.js"; /** * Validate (and optionally mutate) an LLM response. * * @param responseText - The raw text returned by the model. * @param config - Validation rules and action preferences. * @param retryCount - Current retry iteration (passed through to result). * @returns A {@link ResponseValidationResult} with the (possibly truncated) * text, a disposition action, all issues found, and optional feedback. */ export declare function validateResponse(responseText: string, config: ResponseValidationConfig, retryCount?: number): ResponseValidationResult;