//#region src/providers/transformersAvailability.ts
/**
* Utility for checking @huggingface/transformers availability.
*
* This module provides lazy checking of the optional @huggingface/transformers dependency
* with caching to avoid repeated import attempts.
*/
let transformersAvailableCache = null;
/**
* Checks if the @huggingface/transformers library is available.
* Result is cached after first call for efficiency.
*/
async function isTransformersAvailable() {
	if (transformersAvailableCache !== null) return transformersAvailableCache;
	try {
		await import("@huggingface/transformers");
		transformersAvailableCache = true;
	} catch {
		transformersAvailableCache = false;
	}
	return transformersAvailableCache;
}
/**
* Validates that the @huggingface/transformers library is installed.
* Throws an error with installation instructions if not available.
*
* Call this early (before pipeline creation) to fail fast with a helpful message.
*/
async function validateTransformersDependency(checkTransformers = isTransformersAvailable) {
	if (!await checkTransformers()) throw new Error("@huggingface/transformers is required for local embedding and text generation providers.\nInstall it with: npm install @huggingface/transformers");
}
//#endregion
exports.validateTransformersDependency = validateTransformersDependency;

//# sourceMappingURL=transformersAvailability-BSHPVuKH.cjs.map