first commit
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
const logger = require('../utils/logger');
|
||||
|
||||
const groqConfig = {
|
||||
// API Configuration
|
||||
apiKey: process.env.GROQ_API_KEY,
|
||||
model: process.env.GROQ_MODEL || 'moonshotai/kimi-k2-instruct-0905',
|
||||
baseURL: process.env.GROQ_BASE_URL || 'https://api.groq.com',
|
||||
|
||||
// Model-specific configurations
|
||||
models: {
|
||||
MODEL1: {
|
||||
model: 'moonshotai/kimi-k2-instruct-0905',
|
||||
temperature: 0.3,
|
||||
maxTokens: 300,
|
||||
topP: 0.9,
|
||||
systemPrompt: `You are MODEL1, an expert engineering reasoning system. Your primary function is to analyze complex engineering problems and create detailed, step-by-step plans to solve them.`
|
||||
},
|
||||
QUERYMODEL: {
|
||||
model: 'moonshotai/kimi-k2-instruct-0905',
|
||||
temperature: 0.5,
|
||||
maxTokens: 400,
|
||||
topP: 0.9,
|
||||
systemPrompt: `You are QUERYMODEL, an expert engineering execution system. Your primary function is to execute engineering plans using various tools and resources.`
|
||||
}
|
||||
},
|
||||
|
||||
// Rate limiting
|
||||
rateLimit: {
|
||||
requestsPerMinute: 60,
|
||||
requestsPerHour: 1000,
|
||||
burstLimit: 10
|
||||
},
|
||||
|
||||
// Retry configuration
|
||||
retry: {
|
||||
maxRetries: 3,
|
||||
retryDelay: 1000,
|
||||
backoffMultiplier: 2
|
||||
},
|
||||
|
||||
// Timeout configuration
|
||||
timeout: {
|
||||
request: 30000, // 30 seconds
|
||||
connection: 10000 // 10 seconds
|
||||
},
|
||||
|
||||
// Logging configuration
|
||||
logging: {
|
||||
logRequests: process.env.NODE_ENV === 'development',
|
||||
logResponses: process.env.NODE_ENV === 'development',
|
||||
logErrors: true
|
||||
}
|
||||
};
|
||||
|
||||
const validateConfig = () => {
|
||||
const errors = [];
|
||||
|
||||
if (!groqConfig.apiKey) {
|
||||
errors.push('GROQ_API_KEY is required');
|
||||
}
|
||||
|
||||
if (!groqConfig.model) {
|
||||
errors.push('GROQ_MODEL is required');
|
||||
}
|
||||
|
||||
if (errors.length > 0) {
|
||||
logger.error('Groq configuration errors:', errors);
|
||||
throw new Error(`Groq configuration invalid: ${errors.join(', ')}`);
|
||||
}
|
||||
|
||||
logger.info('Groq configuration validated successfully');
|
||||
return true;
|
||||
};
|
||||
|
||||
const getModelConfig = (modelType) => {
|
||||
return groqConfig.models[modelType] || groqConfig.models.MODEL1;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
groqConfig,
|
||||
validateConfig,
|
||||
getModelConfig
|
||||
};
|
||||
Reference in New Issue
Block a user