Commit 10ca7a93ac660b03a13ac2a04bfe58bbfa1bc9d4
1 parent
5618313d
【增加】增加 google gemini
Showing
3 changed files
with
17 additions
and
0 deletions
yudao-module-ai/yudao-spring-boot-starter-ai/pom.xml
| ... | ... | @@ -22,6 +22,11 @@ |
| 22 | 22 | <artifactId>spring-ai-openai-spring-boot-starter</artifactId> |
| 23 | 23 | <version>1.0.3</version> |
| 24 | 24 | </dependency> |
| 25 | + <dependency> | |
| 26 | + <groupId>io.springboot.ai</groupId> | |
| 27 | + <artifactId>spring-ai-vertex-ai-gemini</artifactId> | |
| 28 | + <version>1.0.3</version> | |
| 29 | + </dependency> | |
| 25 | 30 | |
| 26 | 31 | <dependency> |
| 27 | 32 | <groupId>cn.iocoder.boot</groupId> | ... | ... |
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/enums/AiPlatformEnum.java
yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/core/factory/AiClientFactoryImpl.java
| ... | ... | @@ -169,4 +169,15 @@ public class AiClientFactoryImpl implements AiClientFactory { |
| 169 | 169 | return new QianWenChatClient(qianWenApi); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | + | |
| 173 | + private static VertexAiGeminiChatClient buildGoogleGemir(String key) { | |
| 174 | + List<String> keys = StrUtil.split(key, '|'); | |
| 175 | + Assert.equals(keys.size(), 2, "VertexAiGeminiChatClient 的密钥需要 (projectId|location) 格式"); | |
| 176 | + VertexAI vertexApi = new VertexAI(keys.get(0), keys.get(1)); | |
| 177 | + return new VertexAiGeminiChatClient(vertexApi, | |
| 178 | + VertexAiGeminiChatOptions.builder() | |
| 179 | + .withTemperature(0.4F) | |
| 180 | + .build()); | |
| 181 | + } | |
| 182 | + | |
| 172 | 183 | } | ... | ... |