-
Notifications
You must be signed in to change notification settings - Fork 128
refactor: replace genAI model sdk by okHttp #206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ructures and update related components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR replaces the Google GenAI Java SDK with dedicated DTOs and direct HTTP calls to the Gemini API, simplifying the implementation and removing dependencies on the Google SDK and Vertex AI support.
- Custom DTOs introduced for all Gemini API request/response structures
- Direct HTTP implementation using OkHttp with SSE streaming support
- All formatters, converters, and parsers updated to use new DTOs
Reviewed changes
Copilot reviewed 32 out of 32 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| GeminiChatModel.java | Replaced SDK client with OkHttpclient for direct API calls with streaming support |
| GeminiRequest.java, GeminiResponse.java | New DTOs for API request/response structures |
| GeminiContent.java, GeminiPart.java | DTOs for message content and parts |
| GeminiTool.java, GeminiToolConfig.java | DTOs for tool definitions and configuration |
| GeminiGenerationConfig.java | DTO for generation parameters |
| GeminiChatFormatter.java | Updated to work with DTOs instead of SDK types |
| GeminiMessageConverter.java | Updated conversion logic for new DTOs |
| GeminiMediaConverter.java | Updated media handling to use DTO Blob type |
| GeminiToolsHelper.java | Simplified tool conversion without SDK schema conversion |
| GeminiResponseParser.java | Updated response parsing for new DTO structures |
| ModelProviderType.java | Simplified Gemini config removing Vertex AI parameters |
| AgentScopeProducer.java | Removed Vertex AI configuration logic |
| pom.xml (core) | Removed google-genai dependency |
| pom.xml (mem0) | Added jackson-datatype-jsr310 dependency |
| Test files | Updated all tests to use new DTOs instead of SDK types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agentscope-core/src/main/java/io/agentscope/core/formatter/gemini/dto/GeminiTool.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/gemini/GeminiMediaConverter.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/model/GeminiChatModel.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/model/GeminiChatModel.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/model/GeminiChatModel.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/gemini/GeminiMessageConverter.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/gemini/GeminiResponseParser.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/formatter/gemini/GeminiResponseParser.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ini/GeminiMediaConverter.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…hatModel.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…hatModel.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… and tracking reasoning tokens.
… and enforce HTTP/1.1 for Gemini models.
…for GeminiChatModel, supporting Vertex AI endpoints.
…le Gemini integration Signed-off-by: liuhy <liuhongyu@apache.org>
Signed-off-by: liuhy <liuhongyu@apache.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
agentscope-extensions/agentscope-extensions-mem0/pom.xml:1
- The jackson-datatype-jsr310 version 2.15.2 may be outdated. Consider using a more recent version that matches the Jackson version used elsewhere in the project, or verify if 2.15.2 is the intended version for compatibility reasons.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Your current logic for handling the Base URL differs from the GenAI SDK's approach, specifically regarding the handling of the |
Signed-off-by: liuhy <liuhongyu@apache.org>
… multi-agent thinking Signed-off-by: liuhy <liuhongyu@apache.org>
…ed logging for Gemini integration Signed-off-by: liuhy <liuhongyu@apache.org>
# Conflicts: # agentscope-extensions/agentscope-extensions-mem0/pom.xml
…i providers Signed-off-by: liuhy <liuhongyu@apache.org>
…ation Signed-off-by: liuhy <liuhongyu@apache.org>
…and update response formatting Signed-off-by: liuhy <liuhongyu@apache.org>
…ompts Signed-off-by: liuhy <liuhongyu@apache.org>
…thinking blocks Signed-off-by: liuhy <liuhongyu@apache.org>



AgentScope-Java Version
[The version of AgentScope-Java you are working on, e.g. 1.0.2, check your pom.xml dependency version or run
mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]Description
[Please describe the background, purpose, changes made, and how to test this PR]
Introduce dedicated DTOs for Gemini API request and response structures and update related components.
fixes #96
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)