【增加】增加 google gemini

This commit is contained in:
cherishsince 2024-05-24 15:06:36 +08:00
parent 5618313d65
commit 10ca7a93ac
3 changed files with 17 additions and 0 deletions

View File

@ -22,6 +22,11 @@
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>io.springboot.ai</groupId>
<artifactId>spring-ai-vertex-ai-gemini</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>

View File

@ -21,6 +21,7 @@ public enum AiPlatformEnum {
OPEN_AI_DALL("dall", "dall"),
MIDJOURNEY("midjourney", "midjourney"),
GEMIR ("gemir ", "gemir "), // google gemir
;

View File

@ -169,4 +169,15 @@ public class AiClientFactoryImpl implements AiClientFactory {
return new QianWenChatClient(qianWenApi);
}
private static VertexAiGeminiChatClient buildGoogleGemir(String key) {
List<String> keys = StrUtil.split(key, '|');
Assert.equals(keys.size(), 2, "VertexAiGeminiChatClient 的密钥需要 (projectId|location) 格式");
VertexAI vertexApi = new VertexAI(keys.get(0), keys.get(1));
return new VertexAiGeminiChatClient(vertexApi,
VertexAiGeminiChatOptions.builder()
.withTemperature(0.4F)
.build());
}
}