UNPKG

node-llm-test

Version:

Generate tests to evaluate the intelligence of large language models.

63 lines (62 loc) 3.16 kB
import { instructionSet } from "./characters"; import { ExpressionPart, IExpressionResult, ILLMTest, ISymbols, SymbolExpression, SymbolTypeOptions } from "./interface"; import { IPrepareResult } from "./interface"; interface IAnswerContext { tokenMap: Readonly<Record<string, ISymbols>>; realMap: Readonly<Record<string, ISymbols>>; partialWords: Readonly<string[]>; correctAnswer: Readonly<string>; sentenceWords: Readonly<string[]>; } export declare class Puzzle implements ILLMTest { readonly result: Readonly<IPrepareResult>; private readonly level; /** * @param inputWords A list of words to be appended into a word list of the * language * @param seed A unique seed to preserve determinism or null to use Math.random. * @param panagrams A list of pangrams to select from * @param level The hardness of the game */ static New: (inputWords?: readonly string[], seed?: number | undefined, pangrams?: readonly string[] | undefined, level?: number) => Puzzle; static readonly VERSION: string; private constructor(); print(output: (...outs: string[]) => unknown): void; answer(strIn: string): { exact: boolean; possible: boolean; possibleReal?: undefined; } | { exact: boolean; possible: boolean; possibleReal: ISymbols; }; printWork(): string; } /** * - read a single answer * - If the characters are a word and its letters complete the alphabet * * TODO: multi-words - if we are given lots of words, parse out the answer */ export declare function answer(strIn: string, context: Readonly<IAnswerContext>): { exact: boolean; possible: boolean; possibleReal?: undefined; } | { exact: boolean; possible: boolean; possibleReal: ISymbols; }; export declare function getMappingMessage(oldS: string, newS: string, symbol: string, expressionDefinition: ExpressionPart[], i: number, identLocation: number, poorCodingStandards: boolean, expressionChange: false | "reverse" | "order"): string; export declare function getInitialDescription(symbol: string, expressionDefinition: ExpressionPart[], symbolExpression: SymbolExpression<SymbolTypeOptions>, excludeMappingInfo: boolean | undefined, instructionWords: typeof instructionSet, isMappingPuzzle: boolean, identLocation: number): string; export declare function getTableMappingHeader(instructionWords: typeof instructionSet): string; export declare function getInstructionsMessage(indirectSymbols: boolean, instructionWords: typeof instructionSet, random: false | ((num: number) => number)): string; export declare function getSymbolisedSentenceOutput(partialTokenizedSentence: string, instructionWords: typeof instructionSet): string; export declare function print(partialTokenizedSentence: string, tokenMap: Record<string, ISymbols>, expression: IExpressionResult, symbolExpression: SymbolExpression<SymbolTypeOptions>, level: number, output: (outs: string) => void, testComplex: { identLocationOrder: number; identLocationType: number; puzzleType: false | "reverse" | "order"; rand: (num: number) => number; }): void; export {};