Commit daf1274
Add spring-ai-google-genai module using Google's new GenAI SDK
Introduces a new module that provides an alternative to spring-ai-vertex-ai-gemini
using Google's latest GenAI SDK. This implementation offers the same functionality
and API surface as the existing Vertex AI module while leveraging Google's new
unified AI platform.
Key Features:
- GoogleGenAiChatModel with identical functionality to VertexAiGeminiChatModel
- Complete support for Gemini Pro, 1.5 Pro, and 2.0 Flash model variants
- Full tool/function calling capabilities via GoogleGenAiToolCallingManager
- Streaming support with reactive programming model
- Comprehensive safety settings and content filtering
- Multi-modal content support (text, images, PDFs)
- Google Search Retrieval integration
- Built-in retry mechanisms and Micrometer observability
Technical Implementation:
- Mirrors the architecture and patterns of spring-ai-vertex-ai-gemini
- Uses Google's com.google.genai.Client instead of Vertex AI SDK
- Maintains full API compatibility with existing Spring AI patterns
- Includes comprehensive test suite covering all functionality areas
- Proper Maven integration and AOT support
Test Coverage:
- 12 comprehensive test classes mirroring vertex-ai-gemini tests
- Integration tests for chat, streaming, tool calling, and observations
- Multi-modal content testing with images and PDFs
- Safety settings and retry mechanism validation
- Schema conversion and JSON handling tests
Signed-off-by: ddobrin <[email protected]>1 parent 49e5c63 commit daf1274
File tree
36 files changed
+4990
-26
lines changed- models
- spring-ai-google-genai
- src
- main
- java/org/springframework/ai/google/genai
- aot
- common
- schema
- resources/META-INF/spring
- test
- java/org/springframework/ai/google/genai
- aot
- schema
- tool
- resources
- prompts
- spring-ai-vertex-ai-gemini/src/test/java/org/springframework/ai/vertexai/gemini
- tool
- spring-ai-commons/src/main/java/org/springframework/ai/observation/conventions
36 files changed
+4990
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
0 commit comments