* 初始化针对不同模型的优化配置
()
| 15 | * 初始化针对不同模型的优化配置 |
| 16 | */ |
| 17 | private initializeOptimizations(): void { |
| 18 | // 通义千问优化配置 |
| 19 | this.optimizations.set('qwen', { |
| 20 | provider: 'qwen', |
| 21 | maxTokens: 2000, |
| 22 | temperature: 0.7, |
| 23 | topP: 0.8, |
| 24 | presencePenalty: 0.0, |
| 25 | frequencyPenalty: 0.0, |
| 26 | stopSequences: ['</result>', '<|im_end|>'], |
| 27 | promptStrategy: { |
| 28 | useSystemMessage: true, |
| 29 | instructionFormat: 'structured', |
| 30 | contextHandling: 'truncate', |
| 31 | responseFormat: 'markdown', |
| 32 | chainOfThought: true, |
| 33 | fewShotExamples: true, |
| 34 | }, |
| 35 | }); |
| 36 | |
| 37 | // 火山引擎优化配置 |
| 38 | this.optimizations.set('volcengine', { |
| 39 | provider: 'volcengine', |
| 40 | maxTokens: 2000, |
| 41 | temperature: 0.7, |
| 42 | topP: 0.9, |
| 43 | presencePenalty: 0.1, |
| 44 | frequencyPenalty: 0.1, |
| 45 | stopSequences: ['</思考>', '</执行>'], |
| 46 | promptStrategy: { |
| 47 | useSystemMessage: true, |
| 48 | instructionFormat: 'conversational', |
| 49 | contextHandling: 'summarize', |
| 50 | responseFormat: 'markdown', |
| 51 | chainOfThought: true, |
| 52 | fewShotExamples: false, |
| 53 | }, |
| 54 | }); |
| 55 | |
| 56 | // OpenAI优化配置 |
| 57 | this.optimizations.set('openai', { |
| 58 | provider: 'openai', |
| 59 | maxTokens: 4000, |
| 60 | temperature: 0.6, |
| 61 | topP: 1.0, |
| 62 | presencePenalty: 0.0, |
| 63 | frequencyPenalty: 0.0, |
| 64 | stopSequences: ['---END---'], |
| 65 | promptStrategy: { |
| 66 | useSystemMessage: true, |
| 67 | instructionFormat: 'direct', |
| 68 | contextHandling: 'sliding-window', |
| 69 | responseFormat: 'structured', |
| 70 | chainOfThought: true, |
| 71 | fewShotExamples: true, |
| 72 | }, |
| 73 | }); |
| 74 |