@mastra/core
Version:
29 lines • 1.29 kB
TypeScript
import type { Mastra } from '../mastra/index.js';
import type { ObservabilityContext } from '../observability/index.js';
import type { MastraScorerEntry } from './base.js';
import type { ScoringEntityType, ScoringSource } from './types.js';
/**
* Maps a key to a stable value in [0, 1) for sampling decisions.
*
* Uses sha256 so the distribution is uniform across the realistic key space (hex trace IDs,
* UUID run IDs) rather than only for synthetic sequential inputs. Reads 6 bytes (48 bits) —
* well within the 53-bit integer range, so no precision loss.
*/
export declare function hashToUnitInterval(key: string): number;
export declare function runScorer({ runId, scorerId, scorerObject, input, output, requestContext, entity, structuredOutput, source, entityType, threadId, resourceId, projectId, mastra, ...observabilityContext }: {
scorerId: string;
scorerObject: MastraScorerEntry;
runId: string;
input: any;
output: any;
requestContext: Record<string, any>;
entity: Record<string, any>;
structuredOutput: boolean;
source: ScoringSource;
entityType: ScoringEntityType;
threadId?: string;
resourceId?: string;
projectId?: string;
mastra?: Mastra;
} & ObservabilityContext): void;
//# sourceMappingURL=hooks.d.ts.map