@mastra/core
Version:
Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.
45 lines • 2.02 kB
TypeScript
/**
* Shared validation helpers for vector store implementations
*
* These helpers provide consistent validation across all vector stores,
* reducing code duplication and ensuring uniform error handling.
*/
/**
* Validates upsert input parameters
*
* @param storeName - Name of the vector store (e.g., 'PG', 'CHROMA')
* @param vectors - Array of vectors to upsert
* @param metadata - Optional metadata array
* @param ids - Optional ids array
* @throws MastraError if validation fails
*/
export declare function validateUpsertInput(storeName: string, vectors: number[][] | undefined | null, metadata?: Record<string, any>[] | null, ids?: string[] | null): void;
/**
* Validates topK parameter for queries
*
* @param storeName - Name of the vector store (e.g., 'PG', 'CHROMA')
* @param topK - Number of results to return
* @throws MastraError if topK is not a positive integer
*/
export declare function validateTopK(storeName: string, topK: number): void;
/**
* Validates vector components for NaN/Infinity values
*
* @param storeName - Name of the vector store (e.g., 'PG', 'CHROMA')
* @param vectors - Array of vectors to validate
* @throws MastraError if any vector contains NaN, Infinity, null, or undefined
*/
export declare function validateVectorValues(storeName: string, vectors: number[][]): void;
/**
* Validates all upsert inputs including vector values
* Combines validateUpsertInput and validateVectorValues
*
* @param storeName - Name of the vector store (e.g., 'PG', 'CHROMA')
* @param vectors - Array of vectors to upsert
* @param metadata - Optional metadata array
* @param ids - Optional ids array
* @param validateValues - Whether to validate vector values for NaN/Infinity (default: false)
* @throws MastraError if validation fails
*/
export declare function validateUpsert(storeName: string, vectors: number[][] | undefined | null, metadata?: Record<string, any>[] | null, ids?: string[] | null, validateValues?: boolean): void;
//# sourceMappingURL=validation.d.ts.map