feat(google): add native Google Gemini API integration#2346
Merged
amitksingh1490 merged 9 commits intomainfrom Feb 2, 2026
Merged
feat(google): add native Google Gemini API integration#2346amitksingh1490 merged 9 commits intomainfrom
amitksingh1490 merged 9 commits intomainfrom
Conversation
- Added unit tests for Google provider implementation in - Added unit tests for Google response DTOs in - Included snapshot tests for request/response handling - Covered model fetching, error handling, and message conversion logic - Used mock server for HTTP interaction testing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implement native support for the Google Gemini API (Vertex AI) to enable advanced features like tool use, reasoning, and robust streaming.
Context
Previously, Google providers were handled via a generic OpenAI-compatible layer. This limited access to Gemini-specific features such as "thinking" blocks (Gemini 2.0), native tool calling structures, and proper error handling for safety filters. This PR introduces a dedicated implementation to unlock the full capabilities of the Gemini models.
Changes
GoogleResponseRepositoryand DTOs inforge_app::dto::googleto handle the specific JSON structure of the Gemini API.thinking_config(reasoning models), safety settings, and grounding metadata.FunctionCallandFunctionResponsehandling, including logic to group consecutive tool results to satisfy API requirements.streamGenerateContentendpoints.provider.jsonto use the newGoogleresponse type for Vertex AI models.Key Implementation Details
TryFromconversions between internal domain types (Context,ChatCompletionMessage) and Google's API types (Request,Response).candidatesoptional and checkingpromptFeedback.ForgeChatRepositoryrouting logic.Use Cases
Testing
provider.jsonor via environment variables.gemini-2.0-flash).Links