adpa-enterprise-framework-automation
Version:
Modular, standards-compliant Node.js/TypeScript automation framework for enterprise requirements, project, and data management. Provides CLI and API for BABOK v3, PMBOK 7th Edition, and DMBOK 2.0 (in progress). Production-ready Express.js API with TypeSpe
93 lines • 2.73 kB
JavaScript
/**
* Configuration for Few-Shot Learning System
*
* This module provides configuration options for the few-shot learning
* system to control how examples are selected and used in AI prompts.
*
* @version 1.0.0
* @author Requirements Gathering Agent Team
* @created 2024
*/
/**
* Default configuration for few-shot learning
*/
export const DEFAULT_FEW_SHOT_CONFIG = {
maxExamples: 2,
enabled: true,
exampleTokenBudget: 0.4, // 40% of token budget for examples
minTokenLimitForExamples: 2000,
randomSelection: false,
priorityDocumentTypes: [
'project-charter',
'requirements-documentation',
'scope-management-plan',
'risk-register',
'stakeholder-register'
],
excludedDocumentTypes: [
// Add document types that shouldn't use examples
]
};
/**
* Configuration for different project sizes
*/
export const PROJECT_SIZE_CONFIGS = {
small: {
maxExamples: 1,
exampleTokenBudget: 0.3
},
medium: {
maxExamples: 2,
exampleTokenBudget: 0.4
},
large: {
maxExamples: 2,
exampleTokenBudget: 0.5
},
enterprise: {
maxExamples: 3,
exampleTokenBudget: 0.6
}
};
/**
* Get configuration based on project context
*/
export function getFewShotConfig(projectSize, customConfig) {
let config = { ...DEFAULT_FEW_SHOT_CONFIG };
// Apply project size specific config
if (projectSize && PROJECT_SIZE_CONFIGS[projectSize]) {
config = { ...config, ...PROJECT_SIZE_CONFIGS[projectSize] };
}
// Apply custom overrides
if (customConfig) {
config = { ...config, ...customConfig };
}
return config;
}
/**
* Determine if few-shot learning should be used for a document type
*/
export function shouldUseFewShotLearning(documentType, tokenLimit, config = DEFAULT_FEW_SHOT_CONFIG) {
// Check if few-shot learning is enabled
if (!config.enabled) {
return false;
}
// Check if document type is excluded
if (config.excludedDocumentTypes.includes(documentType)) {
return false;
}
// Check if token limit is sufficient
if (tokenLimit < config.minTokenLimitForExamples) {
return false;
}
return true;
}
/**
* Calculate optimal number of examples based on token budget
*/
export function calculateOptimalExampleCount(tokenLimit, averageExampleTokens = 800, config = DEFAULT_FEW_SHOT_CONFIG) {
const availableTokensForExamples = tokenLimit * config.exampleTokenBudget;
const maxExamplesByTokens = Math.floor(availableTokensForExamples / averageExampleTokens);
return Math.min(maxExamplesByTokens, config.maxExamples);
}
//# sourceMappingURL=few-shot-config.js.map