UNPKG

@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

75 lines (74 loc) 2.17 kB
/** * @file Length Scorer * Evaluates response length against configured constraints */ import type { LengthScorerConfig, ScoreResult, ScorerInput, ScorerRule } from "../../../types/index.js"; import { BaseRuleScorer } from "./baseRuleScorer.js"; /** * LengthScorer evaluates response length against configurable constraints */ export declare class LengthScorer extends BaseRuleScorer { private _lengthConfig; constructor(config?: LengthScorerConfig); /** * Get length-specific configuration */ get lengthConfig(): LengthScorerConfig; /** * Get rules for this scorer */ getRules(): ScorerRule[]; /** * Measure text length in various units */ private _measureLength; /** * Get length in the configured unit */ private _getLengthInUnit; /** * Count sentences in text */ private _countSentences; /** * Count paragraphs in text */ private _countParagraphs; /** * Estimate token count (rough approximation) * GPT-style: ~4 characters per token on average */ private _estimateTokens; /** * Evaluate a single length rule */ evaluateRule(rule: ScorerRule, input: ScorerInput): { passed: boolean; score: number; }; /** * Override score to add detailed length metrics */ score(input: ScorerInput): Promise<ScoreResult>; } /** * Factory function for creating LengthScorer instances */ export declare function createLengthScorer(config?: LengthScorerConfig): Promise<LengthScorer>; /** * Pre-configured length scorer presets */ export declare const LengthScorerPresets: { /** Short response (50-150 words) */ readonly short: () => LengthScorer; /** Medium response (100-300 words) */ readonly medium: () => LengthScorer; /** Long response (200-500 words) */ readonly long: () => LengthScorer; /** Concise response (max 100 words) */ readonly concise: () => LengthScorer; /** Detailed response (min 300 words) */ readonly detailed: () => LengthScorer; /** Tweet-length (max 280 characters) */ readonly tweet: () => LengthScorer; };