Commit eef9ed1b3e3b39c7eebf9e596af3fc396bb88d6e
1 parent
8b2dcaf9
【优化】自动配置优化,星火、一言 增加 topK topP maxToken Temperature 参数转换
Showing
1 changed file
with
16 additions
and
2 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/config/YudaoAiAutoConfiguration.java
| ... | ... | @@ -30,13 +30,19 @@ public class YudaoAiAutoConfiguration { |
| 30 | 30 | @ConditionalOnProperty(value = "yudao.ai.xinghuo.enable", havingValue = "true") |
| 31 | 31 | public XingHuoChatClient xingHuoChatClient(YudaoAiProperties yudaoAiProperties) { |
| 32 | 32 | YudaoAiProperties.XingHuoProperties xingHuoProperties = yudaoAiProperties.getXinghuo(); |
| 33 | + // 转换配置 | |
| 34 | + XingHuoOptions xingHuoOptions = new XingHuoOptions(); | |
| 35 | + xingHuoOptions.setChatModel(xingHuoProperties.getChatModel()); | |
| 36 | + xingHuoOptions.setTopK(xingHuoProperties.getTopK()); | |
| 37 | + xingHuoOptions.setTemperature(xingHuoProperties.getTemperature()); | |
| 38 | + xingHuoOptions.setMaxTokens(xingHuoProperties.getMaxTokens()); | |
| 33 | 39 | return new XingHuoChatClient( |
| 34 | 40 | new XingHuoApi( |
| 35 | 41 | xingHuoProperties.getAppId(), |
| 36 | 42 | xingHuoProperties.getAppKey(), |
| 37 | 43 | xingHuoProperties.getSecretKey() |
| 38 | 44 | ), |
| 39 | - new XingHuoOptions().setChatModel(xingHuoProperties.getChatModel()) | |
| 45 | + xingHuoOptions | |
| 40 | 46 | ); |
| 41 | 47 | } |
| 42 | 48 | |
| ... | ... | @@ -44,6 +50,7 @@ public class YudaoAiAutoConfiguration { |
| 44 | 50 | @ConditionalOnProperty(value = "yudao.ai.qianwen.enable", havingValue = "true") |
| 45 | 51 | public QianWenChatClient qianWenChatClient(YudaoAiProperties yudaoAiProperties) { |
| 46 | 52 | YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen(); |
| 53 | + // 转换配置 | |
| 47 | 54 | QianWenOptions qianWenOptions = new QianWenOptions(); |
| 48 | 55 | qianWenOptions.setTopK(qianWenProperties.getTopK()); |
| 49 | 56 | qianWenOptions.setTopP(qianWenProperties.getTopP()); |
| ... | ... | @@ -62,6 +69,12 @@ public class YudaoAiAutoConfiguration { |
| 62 | 69 | @ConditionalOnProperty(value = "yudao.ai.yiyan.enable", havingValue = "true") |
| 63 | 70 | public YiYanChatClient yiYanChatClient(YudaoAiProperties yudaoAiProperties) { |
| 64 | 71 | YudaoAiProperties.YiYanProperties yiYanProperties = yudaoAiProperties.getYiyan(); |
| 72 | + // 转换配置 | |
| 73 | + YiYanOptions yiYanOptions = new YiYanOptions(); | |
| 74 | + yiYanOptions.setTopK(yiYanProperties.getTopK()); | |
| 75 | + yiYanOptions.setTopP(yiYanProperties.getTopP()); | |
| 76 | + yiYanOptions.setTemperature(yiYanProperties.getTemperature()); | |
| 77 | + yiYanOptions.setMaxOutputTokens(yiYanProperties.getMaxTokens()); | |
| 65 | 78 | return new YiYanChatClient( |
| 66 | 79 | new YiYanApi( |
| 67 | 80 | yiYanProperties.getAppKey(), |
| ... | ... | @@ -69,6 +82,7 @@ public class YudaoAiAutoConfiguration { |
| 69 | 82 | yiYanProperties.getChatModel(), |
| 70 | 83 | yiYanProperties.getRefreshTokenSecondTime() |
| 71 | 84 | ), |
| 72 | - new YiYanOptions().setMax_output_tokens(2048)); | |
| 85 | + yiYanOptions | |
| 86 | + ); | |
| 73 | 87 | } |
| 74 | 88 | } |
| 75 | 89 | \ No newline at end of file | ... | ... |