@mastra/core
Version:
The core foundation of the Mastra framework, providing essential components and interfaces for building AI-powered applications.
49 lines • 1.61 kB
TypeScript
import { z } from 'zod';
import type { MastraLanguageModel } from '../agent/types';
import { MastraScorer } from './base';
import type { ScoringInput, ScoringInputWithExtractStepResult } from './types';
type LLMJudge = {
model: MastraLanguageModel;
instructions: string;
};
export type LLMScorerOptions<TExtractOutput extends Record<string, any> = any, TScoreOutput = any> = {
name: string;
description: string;
judge: LLMJudge;
extract?: {
description: string;
judge?: LLMJudge;
outputSchema: z.ZodType<TExtractOutput>;
createPrompt: ({ run }: {
run: ScoringInput;
}) => string;
};
analyze: {
description: string;
judge?: LLMJudge;
outputSchema: z.ZodType<TScoreOutput>;
createPrompt: ({ run }: {
run: ScoringInput & {
extractStepResult: TExtractOutput;
};
}) => string;
};
reason?: {
description: string;
judge?: LLMJudge;
createPrompt: ({ run, }: {
run: ScoringInputWithExtractStepResult & {
analyzeStepResult: TScoreOutput;
score: number;
};
}) => string;
};
calculateScore: ({ run }: {
run: ScoringInputWithExtractStepResult & {
analyzeStepResult: TScoreOutput;
};
}) => number;
};
export declare function createLLMScorer<TExtractOutput extends Record<string, any> = any, TScoreOutput = any>(opts: LLMScorerOptions<TExtractOutput, TScoreOutput>): MastraScorer;
export {};
//# sourceMappingURL=llm.d.ts.map