src / config / configSchematics.ts
/**
* @fileoverview Configuration definitions for the RAG plugin parameters.
*/
// Define default values here so that if the user doesn't explicitly set them,
// the system still defaults to a safe and balanced starting point.
export const defaultConfig = {
retrievalLimit: 5, // Default: Retrieve the top 5 chunks of context.
retrievalAffinityThreshold: 0.75, // Default: Only accept chunks with > 75% semantic similarity score.
// Add other parameters here (e.g., max_tokens, temperature)
};
/**
* Utility function to retrieve configuration values or fall back to default settings.
*/
export function getPluginConfig(schematics: any): {get: (key: string) => number} {
return {
// This object acts as a getter for the configuration variables,
// ensuring we always have a value even if it's not explicitly set.
get: (key: string) => {
switch(key) {
case "retrievalLimit":
return schematics.retrievalLimit || defaultConfig.retrievalLimit;
case "retrievalAffinityThreshold":
return schematics.retrievalAffinityThreshold || defaultConfig.retrievalAffinityThreshold;
default:
throw new Error(`Configuration key '${key}' not found.`);
}
}
};
}