【优化】自动配置优化,星火、一言 增加 topK topP maxToken Temperature 参数转换

This commit is contained in:
cherishsince 2024-04-27 17:22:40 +08:00
parent 8b2dcaf910
commit eef9ed1b3e

View File

@ -30,13 +30,19 @@ public class YudaoAiAutoConfiguration {
@ConditionalOnProperty(value = "yudao.ai.xinghuo.enable", havingValue = "true")
public XingHuoChatClient xingHuoChatClient(YudaoAiProperties yudaoAiProperties) {
YudaoAiProperties.XingHuoProperties xingHuoProperties = yudaoAiProperties.getXinghuo();
// 转换配置
XingHuoOptions xingHuoOptions = new XingHuoOptions();
xingHuoOptions.setChatModel(xingHuoProperties.getChatModel());
xingHuoOptions.setTopK(xingHuoProperties.getTopK());
xingHuoOptions.setTemperature(xingHuoProperties.getTemperature());
xingHuoOptions.setMaxTokens(xingHuoProperties.getMaxTokens());
return new XingHuoChatClient(
new XingHuoApi(
xingHuoProperties.getAppId(),
xingHuoProperties.getAppKey(),
xingHuoProperties.getSecretKey()
),
new XingHuoOptions().setChatModel(xingHuoProperties.getChatModel())
xingHuoOptions
);
}
@ -44,6 +50,7 @@ public class YudaoAiAutoConfiguration {
@ConditionalOnProperty(value = "yudao.ai.qianwen.enable", havingValue = "true")
public QianWenChatClient qianWenChatClient(YudaoAiProperties yudaoAiProperties) {
YudaoAiProperties.QianWenProperties qianWenProperties = yudaoAiProperties.getQianwen();
// 转换配置
QianWenOptions qianWenOptions = new QianWenOptions();
qianWenOptions.setTopK(qianWenProperties.getTopK());
qianWenOptions.setTopP(qianWenProperties.getTopP());
@ -62,6 +69,12 @@ public class YudaoAiAutoConfiguration {
@ConditionalOnProperty(value = "yudao.ai.yiyan.enable", havingValue = "true")
public YiYanChatClient yiYanChatClient(YudaoAiProperties yudaoAiProperties) {
YudaoAiProperties.YiYanProperties yiYanProperties = yudaoAiProperties.getYiyan();
// 转换配置
YiYanOptions yiYanOptions = new YiYanOptions();
yiYanOptions.setTopK(yiYanProperties.getTopK());
yiYanOptions.setTopP(yiYanProperties.getTopP());
yiYanOptions.setTemperature(yiYanProperties.getTemperature());
yiYanOptions.setMaxOutputTokens(yiYanProperties.getMaxTokens());
return new YiYanChatClient(
new YiYanApi(
yiYanProperties.getAppKey(),
@ -69,6 +82,7 @@ public class YudaoAiAutoConfiguration {
yiYanProperties.getChatModel(),
yiYanProperties.getRefreshTokenSecondTime()
),
new YiYanOptions().setMax_output_tokens(2048));
yiYanOptions
);
}
}