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,6 +22,11 @@ | ||
| 22 | <artifactId>spring-ai-openai-spring-boot-starter</artifactId> | 22 | <artifactId>spring-ai-openai-spring-boot-starter</artifactId> |
| 23 | <version>1.0.3</version> | 23 | <version>1.0.3</version> |
| 24 | </dependency> | 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 | <dependency> | 31 | <dependency> |
| 27 | <groupId>cn.iocoder.boot</groupId> | 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
| @@ -21,6 +21,7 @@ public enum AiPlatformEnum { | @@ -21,6 +21,7 @@ public enum AiPlatformEnum { | ||
| 21 | 21 | ||
| 22 | OPEN_AI_DALL("dall", "dall"), | 22 | OPEN_AI_DALL("dall", "dall"), |
| 23 | MIDJOURNEY("midjourney", "midjourney"), | 23 | MIDJOURNEY("midjourney", "midjourney"), |
| 24 | + GEMIR ("gemir ", "gemir "), // google gemir | ||
| 24 | 25 | ||
| 25 | ; | 26 | ; |
| 26 | 27 |
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,4 +169,15 @@ public class AiClientFactoryImpl implements AiClientFactory { | ||
| 169 | return new QianWenChatClient(qianWenApi); | 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 | } |