@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
108 lines (107 loc) • 2.81 kB
TypeScript
/**
* @file Format Scorer
* Evaluates response format compliance (JSON, markdown, code, etc.)
*/
import type { FormatScorerConfig, ScoreResult, ScorerInput, ScorerRule } from "../../../types/index.js";
import { BaseRuleScorer } from "./baseRuleScorer.js";
/**
* FormatScorer evaluates response format against expected formats
*/
export declare class FormatScorer extends BaseRuleScorer {
private _formatConfig;
constructor(config?: FormatScorerConfig);
/**
* Get format-specific configuration
*/
get formatConfig(): FormatScorerConfig;
/**
* Get rules for this scorer
*/
getRules(): ScorerRule[];
/**
* Evaluate a single format rule
*/
evaluateRule(rule: ScorerRule, input: ScorerInput): {
passed: boolean;
score: number;
};
/**
* Validate format against allowed formats
*/
private _validateFormat;
/**
* Detect the format of the text
*/
private _detectFormat;
/**
* Check if text is valid JSON
*/
private _isValidJson;
/**
* Check if text appears to be YAML
*/
private _isYaml;
/**
* Check if text is XML
*/
private _isXml;
/**
* Check if text has code blocks
*/
private _hasCodeBlocks;
/**
* Check if text has markdown elements
*/
private _hasMarkdownElements;
/**
* Check if text is a numbered list
*/
private _isNumberedList;
/**
* Check if text is a bullet list
*/
private _isBulletList;
/**
* Check if text has a table
*/
private _hasTable;
/**
* Check markdown-specific requirements
*/
private _checkMarkdownRequirements;
/**
* Check list-specific requirements
*/
private _checkListRequirements;
/**
* Validate JSON against schema (basic validation)
*/
private _validateJsonSchema;
/**
* Override score to add detailed format analysis
*/
score(input: ScorerInput): Promise<ScoreResult>;
}
/**
* Factory function for creating FormatScorer instances
*/
export declare function createFormatScorer(config?: FormatScorerConfig): Promise<FormatScorer>;
/**
* Pre-configured format scorer presets
*/
export declare const FormatScorerPresets: {
/** JSON format */
readonly json: () => FormatScorer;
/** Markdown format */
readonly markdown: () => FormatScorer;
/** Markdown with headings required */
readonly markdownWithHeadings: () => FormatScorer;
/** Bullet list format */
readonly bulletList: () => FormatScorer;
/** Numbered list format */
readonly numberedList: () => FormatScorer;
/** Code response */
readonly code: () => FormatScorer;
/** Plain text only */
readonly plainText: () => FormatScorer;
};